Part Number Hot Search : 
F60255 00115 222AT CP2140 24C32WI AIC1848 836087 34LC02
Product Description
Full Text Search
 

To Download PIC24FJ512GA610T-IBG Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? 2015 microchip technology inc. ds30010074c-page 1 pic24fj1024ga610/gb610 family high-performance cpu modified harvard architecture largest program memory available for pic24 (1024 kbytes) for the most complex applications 32 kbytes sram for all part variants up to 16 mips operation @ 32 mhz 8 mhz fast rc internal oscillator: - 96 mhz pll option - multiple clock divide options - run-time self-calibration capability for maintaining better than 0.20% accuracy - fast start-up 17-bit x 17-bit single-cycle hardware fractional/integer multiplier 32-bit by 16-bit hardware divider 16-bit x 16-bit working register array c compiler optimized instruction set architecture two address generation units for separate read and write addressing of data memory universal serial bus features usb v2.0 on-the-go (otg) compliant dual role capable C can act as either host or peripheral low-speed (1.5 mb/s) and full-speed (12 mb/s) usb operation in host mode full-speed usb operation in device mode high-precision pll for usb usb device mode operation from frc oscillator C no crystal oscillator required supports up to 32 endpoints (16 bidirectional): - usb module can use any ram location on the device as usb endpoint buffers on-chip usb transceiver with interface for off-chip usb transceiver supports control, interrupt, isochronous and bulk transfers on-chip pull-up and pull-down resistors analog features 10/12-bit, up to 24-channel analog-to-digital (a/d) converter: - 12-bit conversion rate of 200 ksps - auto-scan and threshold compare features - conversion available during sleep three rail-to-rail, enhanced analog comparators with programmable input/output configuration charge time measurement unit (ctmu): - used for capacitive touch sensing, up to 24 channels - time measurement down to 100 ps resolution low-power features sleep and idle modes selectively shut down peripherals and/or core for substantial power reduction and fast wake-up doze mode allows cpu to run at a lower clock speed than peripherals alternate clock modes allow on-the-fly switching to a lower clock speed for selective power reduction wide range digitally controlled oscillator (dco) for fast start-up and low-power operation special microcontroller features large, dual partition flash program array: - capable of holding two independent software applications, including bootloader - permits simultaneous programming of one partition while executing application code from the other - allows run-time switching between active partitions 10,000 erase/write cycle endurance, typical data retention: 20 years minimum self-programmable under software control supply voltage range of 2.0v to 3.6v operating ambient temperature range of -40c to +85c on-chip voltage regulators (1.8v) for low-power operation programmable reference clock output in-circuit serial programming? (icsp?) and in-circuit emulation (ice) via 2 pins jtag boundary scan support fail-safe clock monitor operation: - detects clock failure and switches to on-chip, low-power rc oscillator power-on reset (por), brown-out reset (bor), power-up timer (pwrt) and oscillator start-up timer (ost) programmable high/low-voltage detect (hlvd) flexible watchdog timer (wdt) with its own rc oscillator for reliable operation 16-bit microcontrollers with large, dual partition flash program memory and usb on-the-go (otg) downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 2 ? 2015 microchip technology inc. peripheral features peripheral pin select (pps) C allows independent i/o mapping of many peripherals up to 5 external interrupt sources configurable interrupt-on-change on all i/o pins: - each pin is independently configurable for rising edge or falling edge change detection eight-channel dma supports all peripheral modules: - minimizes cpu overhead and increases data throughput five 16-bit timers/counters with prescalers: - can be paired as 32-bit timers/counters six input capture modules, each with a dedicated 16-bit timer six output compare/pwm modules, each with a dedicated 16-bit timer four single output ccps (sccps) and three multiple output ccps (mccps): - independent 16/32-bit time base for each module - internal time base and period registers - legacy pic24f capture and compare modes (16 and 32-bit) - special variable frequency pulse and brushless dc motor output modes enhanced parallel master/slave port (epmp/epsp) hardware real-time clock/calendar (rtcc) with timestamping three 3-wire/4-wire spi modules: - support 4 frame modes - 8-level fifo buffer - support i 2 s operation three i 2 c modules support multi-master/slave mode and 7-bit/10-bit addressing six uart modules: - support rs-485, rs-232 and lin/j2602 - on-chip hardware encoder/decoder for irda ? - auto-wake-up on auto-baud detect (abd) - 4-level deep fifo buffer programmable 32-bit cyclic redundancy check (crc) generator four configurable logic cells (clcs): - two inputs and one output, all mappable to peripherals or i/o pins - and/or/xor logic and d/jk flip-flop functions high-current sink/source (18 ma/18 ma) on all i/o pins configurable open-drain outputs on digital i/o pins 5.5v tolerant inputs on multiple i/o pins downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 3 pic24fj1024ga610/gb610 family pic24fj1024ga610/gb610 family product families the device names, pin counts, memory sizes and peripheral availability of each device are listed in table 1 . their pinout diagrams appear on the following pages. table 1: pic24fj1024ga610/gb610 general purpose families device memory pins analog digital rtcc usb otg program (bytes) data (bytes) total i/o 10/12-bit a/d (ch) comparator ctmu 16/32-bit timer ic/oc/pwm mccp/sccp i 2 c spi uart w/irda ? epmp/epsp clc pic24fj128ga606 128k 32k 64 53 16 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y n pic24fj256ga606 256k 32k 64 53 16 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y n pic24fj512ga606 512k 32k 64 53 16 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y n pic24fj1024ga606 1024k 32k 64 53 16 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y n pic24fj128ga610 128k 32k 100 85 24 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y n pic24fj256ga610 256k 32k 100 85 24 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y n pic24fj512ga610 512k 32k 100 85 24 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y n pic24fj1024ga610 1024k 32k 100 85 24 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y n pic24fj128gb606 128k 32k 64 53 16 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y y pic24fj256gb606 256k 32k 64 53 16 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y y pic24fj512gb606 512k 32k 64 53 16 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y y pic24fj1024gb606 1024k 32k 64 53 16 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y y pic24fj128gb610 128k 32k 100 85 24 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y y pic24fj256gb610 256k 32k 100 85 24 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y y pic24fj512gb610 512k 32k 100 85 24 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y y pic24fj1024gb610 1024k 32k 100 85 24 3 y 5/2 6/6 3/4 3 3 4/2 y 4 y y downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 4 ? 2015 microchip technology inc. pin diagrams ( 2 ) legend: see table 2 for a complete description of pin functions. pinouts are subject to change. note 1: it is recommended to connect the metal pad on the bottom of the 64-pin qfn package to v ss . 2: gray shading indicates 5.5v tolerant input pins. 64-pin tqfp 64-pin qfn (1) 23 4 5 6 7 8 9 10 11 12 13 14 15 16 4847 22 44 2425 26 27 28 29 30 31 32 1 4645 23 4342 41 40 39 6362 61 59 6058 57 56 54 5553 52 51 49 50 3837 34 3635 33 1719 20 21 18 64 v dd v ss rg9 mclr rg8 rg7 rg6 re7 re6 re5rb5 rb4 rb3 rb2 rb1 rb0 osci/rc12 osco/rc15 v ss rd8 rd9 rd10 rd11 rd0 rc13 rc14 v dd rg2rg3 rf6 rf2 rf3 v dd v ss rb11 rb10 rb9 rb8 av ss av dd rb7 rb6 rb12 rb13 rb14 rb15 rf4 rf5 rd7 v cap n/c rf0 rf1 re0 re1 re2 re3 re4 rd6rd5 rd4 rd3 rd2 rd1 pic24fjxxxxga606 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 5 pic24fj1024ga610/gb610 family table 2: complete pin function descriptions (pic24fjxxxga606) pin function pin function 1 ic4/cted4/pmd5/re5 33 rp16 /rf3 2 scl3/ic5/pmd6/re6 34 rp30 /rf2 3 sda3/ic6/pmd7/re7 35 int0/rf6 4 c1ind/ rp21 /icm1/ocm1a/pma5/rg6 36 sda1/rg3 5 c1inc/ rp26 /ocm1b/pma4/rg7 37 scl1/rg2 6 c2ind/ rp19 /icm2/ocm2a/pma3/rg8 38 v dd 7mclr 39 osci/clki/rc12 8 c1inc/c2inc/c3inc/ rp27 /ocm2b/pma2/pmalu/rg9 40 osco/clko/rc15 9v ss 41 v ss 10 v dd 42 clc4out/ rp2 /u6rts /u6bclk/icm5/rd8 11 pgec3/an5/c1ina/ rp18 /icm3/ocm3a/rb5 43 rp4 /pmack2/rd9 12 pged3/an4/c1inb/ rp28 /ocm3b/rb4 44 rp3 /pma15/pmcs2/rd10 13 an3/c2ina/rb3 45 rp12 /pma14/pmcs1/rd11 14 an2/ctcmp/c2inb/ rp13 /cted13/rb2 46 clc3out/ rp11 /u6cts /icm6/rd0 15 pgec1/altcv ref -/altv ref -/an1/ rp1 /cted12/rb1 47 sosci/c3ind/rc13 16 pged1/altcv ref +/altv ref +/an0/ rp0 /pma6/rb0 48 sosco/c3inc/ rpi37 /pwrlclk/rc14 17 pgec2/an6/ rp6 /rb6 49 rp24 /u5tx/icm4/rd1 18 pged2/an7/ rp7 /u6tx/rb7 50 rp23 /pmack1/rd2 19 av dd 51 rp22 /icm7/pmbe0/rd3 20 av ss 52 rp25 /pmwr/pmenb/rd4 21 an8/ rp8 /pwrgt/rb8 53 rp20 /pmrd/pmwr /rd5 22 an9/tmpr / rp9 /t1ck/pma7/rb9 54 c3inb/u5rx/oc4/rd6 23 tms/cv ref /an10/pma13/rb10 55 c3ina/u5rts /u5bclk/oc5/rd7 24 tdo/an11/refi/pma12/rb11 56 v cap 25 v ss 57 n/c 26 v dd 58 u5cts /oc6/rf0 27 tck/an12/u6rx/cted2/pma11/rb12 59 rf1 28 tdi/an13/cted1/pma10/rb13 60 pmd0/re0 29 an14/ rp14 /cted5/ctpls/pma1/pmalh/rb14 61 pmd1/re1 30 an15/ rp29 /cted6/pma0/pmall/rb15 62 pmd2/re2 31 rp10 /sda2/pma9/rf4 63 cted9/pmd3/re3 32 rp17 /scl2/pma8/rf5 64 hlvdin/cted8/pmd4/re4 legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions . note: pinouts are subject to change. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 6 ? 2015 microchip technology inc. pin diagrams ( 2 ) (continued) legend: see table 3 for a complete description of pin functions. pinouts are subject to change. note 1: it is recommended to connect the metal pad on the bottom of the 64-pin qfn package to v ss . 2: gray shading indicates 5.5v tolerant input pins. 64-pin tqfp 64-pin qfn (1) 23 4 5 6 7 8 9 10 11 12 13 14 15 16 4847 22 44 2425 26 27 28 29 30 31 32 1 4645 23 4342 41 40 39 6362 61 59 6058 57 56 54 5553 52 51 49 50 3837 34 3635 33 1719 20 21 18 64 v dd v ss rg9 mclr rg8 rg7 rg6 re7 re6 re5rb5 rb4 rb3 rb2 rb1 rb0 osci/rc12 osco/rc15 v ss rd8 rd9 rd10 rd11 rd0 rc13 rc14 v dd d+/rg2 d-/rg3 v usb3v3 v bus /rf7 rf3 v dd v ss rb11 rb10 rb9 rb8 av ss av dd rb7 rb6 rb12 rb13 rb14 rb15 rf4 rf5 rd7 v cap n/c rf0 rf1 re0 re1 re2 re3 re4rd6 rd5 rd4 rd3 rd2 rd1 pic24fjxxxxgb606 15 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 7 pic24fj1024ga610/gb610 family table 3: complete pin function descriptions (pic24fjxxxgb606) pin function pin function 1 ic4/cted4/pmd5/re5 33 rp16 /usbid/rf3 2 scl3/ic5/pmd6/re6 34 v bus /rf7 3 sda3/ic6/pmd7/re7 35 v usb3v3 4 c1ind/ rp21 /icm1/ocm1a/pma5/rg6 36 d-/rg3 5 c1inc/ rp26 /ocm1b/pma4/rg7 37 d+/rg2 6 c2ind/ rp19 /icm2/ocm2a/pma3/rg8 38 v dd 7mclr 39 osci/clki/rc12 8 c1inc/c2inc/c3inc/ rp27 /ocm2b/pma2/pmalu/rg9 40 osco/clko/rc15 9v ss 41 v ss 10 v dd 42 clc4out/ rp2 /u6rts /u6bclk/icm5/rd8 11 pgec3/an5/c1ina/ rp18 /icm3/ocm3a/rb5 43 rp4 /sda1/pmack2/rd9 12 pged3/an4/c1inb/ rp28 /usboen /ocm3b/rb4 44 rp3 /scl1/pma15/pmcs2/rd10 13 an3/c2ina/rb3 45 rp12 /pma14/pmcs1/rd11 14 an2/ctcmp/c2inb/ rp13 /cted13/rb2 46 clc3out/ rp11 /u6cts /icm6/int0/rd0 15 pgec1/altcv ref -/altv ref -/an1/ rp1 /cted12/rb1 47 sosci/c3ind/rc13 16 pged1/altcv ref +/altv ref +/an0/ rp0 /pma6/rb0 48 sosco/c3inc/ rpi37 /pwrlclk/rc14 17 pgec2/an6/ rp6 /rb6 49 rp24 /u5tx/icm4/rd1 18 pged2/an7/ rp7 /u6tx/rb7 50 rp23 /pmack1/rd2 19 av dd 51 rp22 /icm7/pmbe0/rd3 20 av ss 52 rp25 /pmwr/pmenb/rd4 21 an8/ rp8 /pwrgt/rb8 53 rp20 /pmrd/pmwr /rd5 22 an9/tmpr / rp9 /t1ck/pma7/rb9 54 c3inb/u5rx/oc4/rd6 23 tms/cv ref /an10/pma13/rb10 55 c3ina/u5rts /u5bclk/oc5/rd7 24 tdo/an11/refi/pma12/rb11 56 v cap 25 v ss 57 n/c 26 v dd 58 u5cts /oc6/rf0 27 tck/an12/u6rx/cted2/pma11/rb12 59 rf1 28 tdi/an13/cted1/pma10/rb13 60 pmd0/re0 29 an14/ rp14 /cted5/ctpls/pma1/pmalh/rb14 61 pmd1/re1 30 an15/ rp29 /cted6/pma0/pmall/rb15 62 pmd2/re2 31 rp10 /sda2/pma9/rf4 63 cted9/pmd3/re3 32 rp17 /scl2/pma8/rf5 64 hlvdin/cted8/pmd4/re4 legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions . note: pinouts are subject to change. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 8 ? 2015 microchip technology inc. pin diagrams ( 1 ) (continued) legend: see ta b l e 4 for a complete description of pin functions. pinouts are subject to change. note 1: gray shading indicates 5.5v tolerant input pins. 100-pin tqfp 92 9493 91 90 89 88 87 86 85 84 83 82 81 80 79 78 20 23 4 5 6 7 8 9 10 11 12 13 14 15 16 6564 63 62 61 60 59 26 56 45 44 43 42 41 40 39 2829 30 31 32 33 34 35 36 37 38 1718 19 21 22 95 1 76 77 7271 70 69 68 67 66 7574 73 5857 24 2325 96 9897 99 2746 47 48 49 50 5554 53 52 51 100 rd5rd4 rd13 rd12 rd3 rd2 rd1 ra7ra6 re2 rg13 rg12 rg14 re1 re0 rg0 re4re3 rf0 v cap rc13 rd0 rd10 rd9 rd8 rd11 ra15 ra14 osco/rc15 osci/rc12 v dd rg2 rf6 rf7 rf8 rg3 rf2 rf3 v ss rc14 ra10 ra9 av dd av ss rb8rb9 rb10 rb11 v dd rf12 rf13 v ss v dd rd15 rd14 rb6rb7 rf5 rf4 re5re6 re7 rc1rc2 rc3 rc4 rg6 v dd ra0re8 re9 rb5 rb4 rb3 rb2 rg7rg8 rb1rb0 rg15 v dd rg9 mclr rb12 rb13 rb14 rb15 rg1 rf1 rd7 rd6 ra5ra3 ra2 v ss v ss v ss n/c ra4 ra1 pic24fjxxxxga610 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 9 pic24fj1024ga610/gb610 family table 4: complete pin function desc riptions (pic24fjxxxga610 tqfp) pin function pin function 1 ocm1c/cted3/rg15 51 rp16 /rf3 2v dd 52 rp30 /rf2 3 ic4/cted4/pmd5/re5 53 rp15 /rf8 4 scl3/ic5/pmd6/re6 54 rf7 5 sda3/ic6/pmd7/re7 55 int0/rf6 6 rpi38 /ocm1d/rc1 56 sda1/rg3 7 rpi39 /ocm2c/rc2 57 scl1/rg2 8 rpi40 /ocm2d/rc3 58 pmpcs1/scl2/ra2 9 an16/ rpi41 /ocm3c/pmcs2/rc4 59 sda2/pma20/ra3 10 an17/c1ind/ rp21 /icm1/ocm1a/pma5/rg6 60 tdi/pma21/ra4 11 an18/c1inc/ rp26 /ocm1b/pma4/rg7 61 tdo/ra5 12 an19/c2ind/ rp19 /icm2/ocm2a/pma3/rg8 62 v dd 13 mclr 63 osci/clki/rc12 14 an20/c1inc/c2inc/c3inc/ rp27 /ocm2b/pma2/pmalu/rg9 64 osco/clko/rc15 15 v ss 65 v ss 16 v dd 66 rpi36 /pma22/ra14 17 tms/ocm3d/cted14/ra0 67 rpi35 /pmbe1/ra15 18 rpi33 /pmcs1/re8 68 clc4out/ rp2 /u6rts /u6bclk/icm5/rd8 19 an21/ rpi34 /pma19/re9 69 rp4 /pmack2/rd9 20 pgec3/an5/c1ina/ rp18 /icm3/ocm3a/rb5 70 rp3 /pma15/pmcs2/rd10 21 pged3/an4/c1inb/ rp28 /ocm3b/rb4 71 rp12 /pma14/pmcs1/rd11 22 an3/c2ina/rb3 72 clc3out/ rp11 /u6cts /icm6/rd0 23 an2/ctcmp/c2inb/ rp13 /cted13/rb2 73 sosci/c3ind/rc13 24 pgec1/altcv ref -/altv ref -/an1/ rp1 /cted12/rb1 74 sosco/c3inc/ rpi37 /pwrlclk/rc14 25 pged1/altcv ref +/altv ref +/an0/ rp0 /rb0 75 v ss 26 pgec2/an6/ rp6 /rb6 76 rp24 /u5tx/icm4/rd1 27 pged2/an7/ rp7 /u6tx/rb7 77 rp23 /pmack1/rd2 28 cv ref -/v ref -/pma7/ra9 78 rp22 /icm7/pmbe0/rd3 29 cv ref +/v ref +/pma6/ra10 79 rpi42 /ocm3e/pmd12/rd12 30 av dd 80 ocm3f/pmd13/rd13 31 av ss 81 rp25 /pmwr/pmenb/rd4 32 an8/ rp8 /pwrgt/rb8 82 rp20 /pmrd/pmwr /rd5 33 an9/tmpr / rp9 /t1ck/rb9 83 c3inb/u5rx/oc4/pmd14/rd6 34 cv ref /an10/pma13/rb10 84 c3ina/u5rts /u5bclk/oc5/pmd15/rd7 35 an11/refi/pma12/rb11 85 v cap 36 v ss 86 n/c 37 v dd 87 u5cts /oc6/pmd11/rf0 38 tck/ra1 88 pmd10/rf1 39 rp31 /rf13 89 pmd9/rg1 40 rpi32 /cted7/pma18/rf12 90 pmd8/rg0 41 an12/u6rx/cted2/pma11/rb12 91 an23/ocm1e/ra6 42 an13/cted1/pma10/rb13 92 an22/ocm1f/pma17/ra7 43 an14/ rp14 /cted5/ctpls/pma1/pmalh/rb14 93 pmd0/re0 44 an15/ rp29 /cted6/pma0/pmall/rb15 94 pmd1/re1 45 v ss 95 cted11/pma16/rg14 46 v dd 96 ocm2e/rg12 47 rpi43 /rd14 97 ocm2f/cted10/rg13 48 rp5 /rd15 98 pmd2/re2 49 rp10 /pma9/rf4 99 cted9/pmd3/re3 50 rp17 /pma8/rf5 100 hlvdin/cted8/pmd4/re4 legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions . note: pinouts are subject to change. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 10 ? 2015 microchip technology inc. pin diagrams ( 1 ) (continued) legend: see ta b l e 5 for a complete description of pin functions. pinouts are subject to change. note 1: gray shading indicates 5.5v tolerant input pins. 100-pin tqfp 92 9493 91 90 89 88 87 86 85 84 83 82 81 80 79 78 20 23 4 5 6 7 8 9 10 11 12 13 14 15 16 6564 63 62 61 60 59 26 56 45 44 43 42 41 40 39 2829 30 31 32 33 34 35 36 37 38 1718 19 21 22 95 1 76 77 7271 70 69 68 67 66 7574 73 5857 24 2325 96 9897 99 2746 47 48 49 50 5554 53 52 51 100 rd5rd4 rd13 rd12 rd3 rd2 rd1 ra7ra6 re2rg13 rg12 rg14 re1 re0 rg0 re4re3 rf0 v cap rc13rd0 rd10 rd9 rd8 rd11 ra15 ra14 osco/rc15 osci/rc12 v dd d+/rg2v usb3v3 v bus /rf7 rf8 d-/rg3 rf2 rf3 v ss rc14 ra10 ra9 av dd av ss rb8rb9 rb10 rb11 v dd rf12 rf13 v ss v dd rd15 rd14 rb6rb7 rf5 rf4 re5 re6 re7 rc1rc2 rc3 rc4 rg6 v dd ra0 re8 re9 rb5 rb4 rb3 rb2 rg7rg8 rb1 rb0 rg15 v dd rg9 mclr rb12rb13 rb14 rb15 rg1 rf1 rd7 rd6 ra5 ra3 ra2 v ss v ss v ss n/c ra4 ra1 pic24fjxxxxgb610 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 11 pic24fj1024ga610/gb610 family table 5: complete pin function desc riptions (pic24fjxxxgb610 tqfp) pin function pin function 1 ocm1c/cted3/rg15 51 rp16 /usbid/rf3 2v dd 52 rp30 /rf2 3 ic4/cted4/pmd5/re5 53 rp15 /rf8 4 scl3/ic5/pmd6/re6 54 v bus /rf7 5 sda3/ic6/pmd7/re7 55 v usb3v3 6 rpi38 /ocm1d/rc1 56 d-/rg3 7 rpi39 /ocm2c/rc2 57 d+/rg2 8 rpi40 /ocm2d/rc3 58 pmpcs1/scl2/ra2 9 an16/ rpi41 /ocm3c/pmcs2/rc4 59 sda2/pma20/ra3 10 an17/c1ind/ rp21 /icm1/ocm1a/pma5/rg6 60 tdi/pma21/ra4 11 an18/c1inc/ rp26 /ocm1b/pma4/rg7 61 tdo/ra5 12 an19/c2ind/ rp19 /icm2/ocm2a/pma3/rg8 62 v dd 13 mclr 63 osci/clki/rc12 14 an20/c1inc/c2inc/c3inc/ rp27 /ocm2b/pma2/pmalu/rg9 64 osco/clko/rc15 15 v ss 65 v ss 16 v dd 66 rpi36 /scl1/pma22/ra14 17 tms/ocm3d/cted14/ra0 67 rpi35 /sda1/pmbe1/ra15 18 rpi33 /pmcs1/re8 68 clc4out/ rp2 /u6rts /u6bclk/icm5/rd8 19 an21/ rpi34 /pma19/re9 69 rp4 /pmack2/rd9 20 pgec3/an5/c1ina/ rp18 /icm3/ocm3a/rb5 70 rp3 /pma15/pmcs2/rd10 21 pged3/an4/c1inb/ rp28 /usboen /ocm3b/rb4 71 rp12 /pma14/pmcs1/rd11 22 an3/c2ina/rb3 72 clc3out/ rp11 /u6cts /icm6/int0/rd0 23 an2/ctcmp/c2inb/ rp13 /cted13/rb2 73 sosci/c3ind/rc13 24 pgec1/altcv ref -/altv ref -/an1/ rp1 /cted12/rb1 74 sosco/c3inc/ rpi37 /pwrlclk/rc14 25 pged1/altcv ref +/altv ref +/an0/ rp0 /rb0 75 v ss 26 pgec2/an6/ rp6 /rb6 76 rp24 /u5tx/icm4/rd1 27 pged2/an7/ rp7 /u6tx/rb7 77 rp23 /pmack1/rd2 28 cv ref -/v ref -/pma7/ra9 78 rp22 /icm7/pmbe0/rd3 29 cv ref +/v ref +/pma6/ra10 79 rpi42 /ocm3e/pmd12/rd12 30 av dd 80 ocm3f/pmd13/rd13 31 av ss 81 rp25 /pmwr/pmenb/rd4 32 an8/ rp8 /pwrgt/rb8 82 rp20 /pmrd/pmwr /rd5 33 an9/tmpr / rp9 /t1ck/rb9 83 c3inb/u5rx/oc4/pmd14/rd6 34 cv ref /an10/pma13/rb10 84 c3ina/u5rts /u5bclk/oc5/pmd15/rd7 35 an11/refi/pma12/rb11 85 v cap 36 v ss 86 n/c 37 v dd 87 u5cts /oc6/pmd11/rf0 38 tck/ra1 88 pmd10/rf1 39 rp31 /rf13 89 pmd9/rg1 40 rpi32 /cted7/pma18/rf12 90 pmd8/rg0 41 an12/u6rx/cted2/pma11/rb12 91 an23/ocm1e/ra6 42 an13/cted1/pma10/rb13 92 an22/ocm1f/pma17/ra7 43 an14/ rp14 /cted5/ctpls/pma1/pmalh/rb14 93 pmd0/re0 44 an15/ rp29 /cted6/pma0/pmall/rb15 94 pmd1/re1 45 v ss 95 cted11/pma16/rg14 46 v dd 96 ocm2e/rg12 47 rpi43 /rd14 97 ocm2f/cted10/rg13 48 rp5 /rd15 98 pmd2/re2 49 rp10 /pma9/rf4 99 cted9/pmd3/re3 50 rp17 /pma8/rf5 100 hlvdin/cted8/pmd4/re4 legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions. note: pinouts are subject to change. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 12 ? 2015 microchip technology inc. pin diagrams ( 1 ) (continued) legend: see ta b l e 6 for a complete description of pin functions. pinouts are subject to change. note 1: gray shading indicates 5.5v tolerant input pins. pic24fjxxxga610 121-pin bga re4 re3 rg13 re0 rg0 rf1 rd12 rd2 rd1 rg15 re2 re1 ra7 rf0 v cap rd5 rd3 v ss rc14 re6 v dd rg12 rg14 ra6 rd7 rd4 rc13 rd11 rc1 re7 re5 rd6 rd13 rd0 rd10 rc4 rc3 rg6 rc2 rg1 ra15 rd8 rd9 ra14 mclr rg8 rg9 rg7 v ss v dd rc12 v ss rc15 re8 re9 ra0 v dd v ss v ss ra5 ra3 ra4 rb5 rb4 v dd rf7 rf6 rg2 ra2 rb3 rb2 rb7 av dd rb11 ra1 rb12 rf8 rg3 rb1 rb0 ra10 rb8 rf12 rb14 v dd rd15 rf3 rf2 rb6 ra9 av ss rb9 rb10 rf13 rb13 rb15 rd14 rf4 rf5 1234567891 01 1 ab cd e f g h j k l n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 13 pic24fj1024ga610/gb610 family table 6: complete pin function de scriptions (pic24fjxxxga610 bga) pin full pin name pin full pin name a1 hlvdin/cted8/pmd4/re4 e1 an16/ rpi41 /ocm3c/pmcs2/rc4 a2 cted9/pmd3/re3 e2 rpi40 /ocm2d/rc3 a3 ocm2f/cted10/rg13 e3 an17/c1ind/ rp21 /icm1/ocm1a/pma5/rg6 a4 pmd0/re0 e4 rpi39 /ocm2c/rc2 a5 pmd8/rg0 e5 n/c a6 pmd10/rf1 e6 pmd9/rg1 a7 n/c e7 n/c a8 n/c e8 rpi35 /pmbe1/ra15 a9 rpi42 /ocm3e/pmd12/rd12 e9 clc4out/ rp2 /u6rts /u6bclk/icm5/rd8 a10 rp23 /pmack1/rd2 e10 rp4 /pmack2/rd9 a11 rp24 /u5tx/icm4/rd1 e11 rpi36 /pma22/ra14 b1 n/c f1 mclr b2 ocm1c/cted3/rg15 f2 an19/c2ind/ rp19 /icm2/ocm2a/pma3/rg8 b3 pmd2/re2 f3 an20/c1inc/c2inc/c3inc/ rp27 /ocm2b/pma2/pmalu/ rg9 b4 pmd1/re1 f4 an18/c1inc/ rp26 /ocm1b/pma4/rg7 b5 an22/ocm1f/pma17/ra7 f5 v ss b6 u5cts /oc6/pmd11/rf0 f6 n/c b7 v cap f7 n/c b8 rp20 /pmrd/pmwr /rd5 f8 v dd b9 rp22 /icm7/pmbe0/rd3 f9 osci/clki/rc12 b10 v ss f10 v ss b11 sosco/c3inc/ rpi37 /pwrlclk/rc14 f11 osco/clko/rc15 c1 scl3/ic5/pmd6/re6 g1 rpi33 /pmcs1/re8 c2 v dd g2 an21/ rpi34 /pma19/re9 c3 ocm2e/rg12 g3 tms/ocm3d/cted14/ra0 c4 cted11/pma16/rg14 g4 n/c c5 an23/ocm1e/ra6 g5 v dd c6 n/c g6 v ss c7 c3ina/u5rts /u5bclk/oc5/pmd15/rd7 g7 v ss c8 rp25 /pmwr/pmenb/rd4 g8 n/c c9 n/c g9 tdo/ra5 c10 sosci/c3ind/rc13 g10 sda2/pma20/ra3 c11 rp12 /pma14/pmcs1/rd11 g11 tdi/pma21/ra4 d1 rpi38 /ocm1d/rc1 h1 pgec3/an5/c1ina/ rp18 /icm3/ocm3a/rb5 d2 sda3/ic6/pmd7/re7 h2 pged3/an4/c1inb/ rp28 /ocm3b/rb4 d3 ic4/cted4/pmd5/re5 h3 n/c d4 n/c h4 n/c d5 n/c h5 n/c d6 n/c h6 v dd d7 c3inb/u5rx/oc4/pmd14/rd6 h7 n/c d8 ocm3f/pmd13/rd13 h8 rf7 d9 clc3out/ rp11 /u6cts /icm6/rd0 h9 int0/rf6 d10 n/c h10 scl1/rg2 d11 rp3 /pma15/pmcs2/rd10 h11 pmpcs1/scl2/ra2 legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions. note: pinouts are subject to change. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 14 ? 2015 microchip technology inc. j1 an3/c2ina/rb3 k7 an14/ rp14 /cted5/ctpls/pma1/pmalh/rb14 j2 an2/ctcmp/c2inb/ rp13 /cted13/rb2 k8 v dd j3 pged2/an7/ rp7 /u6tx/rb7 k9 rp5 /rd15 j4 av dd k10 rp16 /rf3 j5 an11/refi/pma12/rb11 k11 rp30 /rf2 j6 tck/ra1 l1 pgec2/an6/ rp6 /rb6 j7 an12/u6rx/cted2/pma11/rb12 l2 cv ref -/v ref -/pma7/ra9 j8 n/c l3 av ss j9 n/c l4 an9/tmpr / rp9 /t1ck/rb9 j10 rp15 /rf8 l5 cv ref /an10/pma13/rb10 j11 sda1/rg3 l6 rp31 /rf13 k1 pgec1/altcv ref -/altv ref -/an1/ rp1 /cted12/rb1 l7 an13/cted1/pma10/rb13 k2 pged1/altcv ref +/altv ref +/an0/ rp0 /rb0 l8 an15/ rp29 /cted6/pma0/pmall/rb15 k3 cv ref +/v ref +/pma6/ra10 l9 rpi43 /rd14 k4 an8/ rp8 /pwrgt/rb8 l10 rp10 /pma9/rf4 k5 n/c l11 rp17 /pma8/rf5 k6 rpi32 /cted7/pma18/rf12 table 6: complete pin funct ion descriptions (pic24fj xxxga610 bga) (continued) pin full pin name pin full pin name legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions. note: pinouts are subject to change. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 15 pic24fj1024ga610/gb610 family pin diagrams ( 1 ) (continued) legend: see ta b l e 7 for a complete description of pin functions. pinouts are subject to change. note 1: gray shading indicates 5.5v tolerant input pins. pic24fjxxxgb610 121-pin bga re4 re3 rg13 re0 rg0 rf1 rd12 rd2 rd1 rg15 re2 re1 ra7 rf0 v cap rd5 rd3 v ss rc14 re6 v dd rg12 rg14 ra6 rd7 rd4 rc13 rd11 rc1 re7 re5 rd6 rd13 rd0 rd10 rc4 rc3 rg6 rc2 rg1 ra15 rd8 rd9 ra14 mclr rg8 rg9 rg7 v ss v dd rc12 v ss rc15 re8 re9 ra0 v dd v ss v ss ra5 ra3 ra4 rb5 rb4 v dd v bus /rf7 v usb3v3 d+/rg2 ra2 rb3 rb2 rb7 av dd rb11 ra1 rb12 rf8 d-/rg3 rb1 rb0 ra10 rb8 rf12 rb14 v dd rd15 rf3 rf2 rb6 ra9 av ss rb9 rb10 rf13 rb13 rb15 rd14 rf4 rf5 1234567891 01 1 ab cd e f g h j k l n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c n/c downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 16 ? 2015 microchip technology inc. table 7: complete pin function de scriptions (pic24fjxxxgb610 bga) pin full pin name pin full pin name a1 hlvdin/cted8/pmd4/re4 e1 an16/ rpi41 /ocm3c/pmcs2/rc4 a2 cted9/pmd3/re3 e2 rpi40 /ocm2d/rc3 a3 ocm2f/cted10/rg13 e3 an17/c1ind/ rp21 /icm1/ocm1a/pma5/rg6 a4 pmd0/re0 e4 rpi39 /ocm2c/rc2 a5 pmd8/rg0 e5 n/c a6 pmd10/rf1 e6 pmd9/rg1 a7 n/c e7 n/c a8 n/c e8 rpi35 /sda1/pmbe1/ra15 a9 rpi42 /ocm3e/pmd12/rd12 e9 clc4out/ rp2 /u6rts /u6bclk/icm5/rd8 a10 rp23 /pmack1/rd2 e10 rp4 /pmack2/rd9 a11 rp24 /u5tx/icm4/rd1 e11 rpi36 /scl1/pma22/ra14 b1 n/c f1 mclr b2 ocm1c/cted3/rg15 f2 an19/c2ind/ rp19 /icm2/ocm2a/pma3/rg8 b3 pmd2/re2 f3 an20/c1inc/c2inc/c3inc/ rp27 /ocm2b/pma2/pmalu/ rg9 b4 pmd1/re1 f4 an18/c1inc/ rp26 /ocm1b/pma4/rg7 b5 an22/ocm1f/pma17/ra7 f5 v ss b6 u5cts /oc6/pmd11/rf0 f6 n/c b7 v cap f7 n/c b8 rp20 /pmrd/pmwr /rd5 f8 v dd b9 rp22 /icm7/pmbe0/rd3 f9 osci/clki/rc12 b10 v ss f10 v ss b11 sosco/c3inc/ rpi37 /pwrlclk/rc14 f11 osco/clko/rc15 c1 scl3/ic5/pmd6/re6 g1 rpi33 /pmcs1/re8 c2 v dd g2 an21/ rpi34 /pma19/re9 c3 ocm2e/rg12 g3 tms/ocm3d/cted14/ra0 c4 cted11/pma16/rg14 g4 n/c c5 an23/ocm1e/ra6 g5 v dd c6 n/c g6 v ss c7 c3ina/u5rts /u5bclk/oc5/pmd15/rd7 g7 v ss c8 rp25 /pmwr/pmenb/rd4 g8 n/c c9 n/c g9 tdo/ra5 c10 sosci/c3ind/rc13 g10 sda2/pma20/ra3 c11 rp12 /pma14/pmcs1/rd11 g11 tdi/pma21/ra4 d1 rpi38 /ocm1d/rc1 h1 pgec3/an5/c1ina/ rp18 /icm3/ocm3a/rb5 d2 sda3/ic6/pmd7/re7 h2 pged3/an4/c1inb/ rp28 /usboen /ocm3b/rb4 d3 ic4/cted4/pmd5/re5 h3 n/c d4 n/c h4 n/c d5 n/c h5 n/c d6 n/c h6 v dd d7 c3inb/u5rx/oc4/pmd14/rd6 h7 n/c d8 ocm3f/pmd13/rd13 h8 v bus /rf7 d9 clc3out/ rp11 /u6cts /icm6/int0/rd0 h9 v usb3v3 d10 n/c h10 d+/rg2 d11 rp3 /pma15/pmcs2/rd10 h11 pmpcs1/scl2/ra2 legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions. note: pinouts are subject to change.l downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 17 pic24fj1024ga610/gb610 family j1 an3/c2ina/rb3 k7 an14/ rp14 /cted5/ctpls/pma1/pmalh/rb14 j2 an2/ctcmp/c2inb/ rp13 /cted13/rb2 k8 v dd j3 pged2/an7/ rp7 /u6tx/rb7 k9 rp5 /rd15 j4 av dd k10 rp16 /usbid/rf3 j5 an11/refi/pma12/rb11 k11 rp30 /rf2 j6 tck/ra1 l1 pgec2/an6/ rp6 /rb6 j7 an12/u6rx/cted2/pma11/rb12 l2 cv ref -/v ref -/pma7/ra9 j8 n/c l3 av ss j9 n/c l4 an9/tmpr / rp9 /t1ck / rb9 j10 rp15 /rf8 l5 cv ref /an10/pma13/rb10 j11 d-/rg3 l6 rp31 /rf13 k1 pgec1/altcv ref -/altv ref -/an1/ rp1 /cted12/rb1 l7 an13/cted1/pma10/rb13 k2 pged1/altcv ref +/altv ref +/an0/ rp0 /rb0 l8 an15/ rp29 /cted6/pma0/pmall/rb15 k3 cv ref +/v ref +/pma6/ra10 l9 rpi43 /rd14 k4 an8/ rp8 /pwrgt/rb8 l10 rp10 /pma9/rf4 k5 n/c l11 rp17 /pma8/rf5 k6 rpi32 /cted7/pma18/rf12 table 7: complete pin funct ion descriptions (pic24fj xxxgb610 bga) (continued) pin full pin name pin full pin name legend: rpn and rpin represent remappable pins for peripheral pin select (pps) functions. note: pinouts are subject to change.l downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 18 ? 2015 microchip technology inc. table of contents 1.0 device overview .............................................................................. .......................................................................................... 21 2.0 guidelines for getting started with 16-bit microcontroller s ................................................................. ....................................... 41 3.0 cpu ............................................................................................... ......................... ................................................................... 47 4.0 memory organization .......................................... ................................................... ............ ........................................................ 53 5.0 direct memory access controller (dma) ..................................... .................................................. ............................................ 81 6.0 flash program memory..................................................... ................................................... ...................................................... 89 7.0 resets .......................................................................................... .............................................................................................. 97 8.0 interrupt controller ................................................................ ........................................ ........................................................... 103 9.0 oscillator configuration ...................................... ......................................................................................................... ............. 115 10.0 power-saving features......................................................... ............................................. ...................................................... 135 11.0 i/o ports ....................................................................................... ........................... ................................................................. 147 12.0 timer1 .......................................................................................... ............................................................................................ 183 13.0 timer2/3 and timer4/5 ...................................... ................................................... ............ ....................................................... 185 14.0 input capture with dedicated timers ................................... ................................................... .. ............................................... 191 15.0 output compare with dedicated timers ...................................... ............................................................................................ 197 16.0 capture/compare/pwm/timer modules (mccp and sccp) ............................. ............................................. ........................ 207 17.0 serial peripheral interface (spi)........................................ .................................................. ..................................................... 225 18.0 inter-integrated circuit (i 2 c) ....................................................................................................... .............................................. 245 19.0 universal asynchronous receiver transmitter (uart) ............................... .......................................... .................................. 253 20.0 universal serial bus with on-the-go support (usb otg) ......................... ............................................. ............................... 263 21.0 enhanced parallel master port (epmp) .................................. ................................................... .. ............................................ 297 22.0 real-time clock and calendar (rtcc) with timestamp............................... .......................................... ................................ 309 23.0 32-bit programmable cyclic redundancy che ck (crc) generator ............................................... ................. ........................ 329 24.0 configurable logic cell (clc)........................................ ................................................... ... .................................................... 335 25.0 12-bit a/d converter with threshold detect .............................. ................................................... ........................................... 345 26.0 triple comparator module...................................... ................................................... .......... ..................................................... 367 27.0 comparator voltage reference.................................. ................................................... .......... ................................................. 373 28.0 charge time measurement unit (ctmu) .......................................... .............................................. ........................................ 375 29.0 high/low-voltage detect (hlvd)........................................ ................................................... .. ................................................ 385 30.0 special features ........................................................................ ................................... ........................................................... 387 31.0 development support............................................ ................................................... ......... ....................................................... 405 32.0 instruction set summary ....................................................... ............................................. ...................................................... 409 33.0 electrical characteristics ..................................................... ............................................ ......................................................... 417 34.0 packaging information............................................................. ......................................... ........................................................ 439 appendix a: revision history.......................................... ................................................... ...... .......................................................... 453 index ................................................. ................................................... ...................... ....................................................................... 455 the microchip web site ....................................................................... .................................. ............................................................ 461 customer change notification service ....................................... ................................................... . ................................................... 461 customer support ............................................... ................................................... ............. ............................................................... 461 product identification system...................................................... ............................................ ........................................................... 463 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 19 pic24fj1024ga610/gb610 family to our valued customers it is our intention to provide our valued customers with the best documentation possible to ensure successful use of your micro chip products. to this end, we will continue to improve our publications to better suit your needs. our publications will be refined and enhanced as new volumes and updates are introduced. if you have any questions or comments regar ding this publication, please contact the marketing communications department via e-mail at docerrors@microchip.com . we welcome your feedback. most current data sheet to obtain the most up-to-date version of this data s heet, please register at our worldwide web site at: http://www.microchip.com you can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page . the last character of the literature number is the versi on number, (e.g., ds30000000a is ve rsion a of document ds30000000). errata an errata sheet, describing minor operational differences fr om the data sheet and recommended workarounds, may exist for curren t devices. as device/documentation issues become known to us, we will publish an errata sheet. the errata will specify the rev isi on of silicon and revision of document to which it applies. to determine if an errata sheet exists for a particul ar device, please check with one of the following: microchips worldwide web site; http://www.microchip.com your local microchip sales office (see last page) when contacting a sales office, please spec ify which device, revision of silicon and data sheet (include literature number) you are using. customer notification system register on our web site at www.microchip.com to receive the most current information on all of our products. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 20 ? 2015 microchip technology inc. referenced sources this device data sheet is based on the following individual chapters of the dspic33/pic24 family reference manual . these documents should be considered as the general reference for the operation of a particular module or device feature. cpu with extended data space (eds) (ds39732) data memory with extended data space (eds) (ds39733) direct memory access controller (dma) (ds39742) pic24f flash program memory (ds30009715) reset (ds39712) interrupts (ds70000600) oscillator (ds39700) power-saving features (ds39698) i/o ports with peripheral pin select (pps) (ds39711) timers (ds39704) input capture with dedicated timer (ds70000352) output compare with dedicated timer (ds70005159) capture/compare/pwm/timer (mccp and sccp) (ds33035a) serial peripheral interface (spi) (ds70005185) inter-integrated circuit? (i 2 c?) (ds70000195) uart (ds39708) usb on-the-go (otg) (ds39721) enhanced parallel master port (epmp) (ds39730) rtcc with timestamp (ds70005193) rtcc with external power control (ds39745) 32-bit programmable cyclic redundancy check (crc) (ds30009729) 12-bit a/d converter with threshold detect (ds39739) scalable comparator module (ds39734) dual comparator module (ds39710) charge time measurement unit (ctmu) with threshold detect (ds39743) high-level integration with programmable high/low-voltage detect (hlvd) (ds39725) watchdog timer (wdt) (ds39697) codeguard? intermediate security (ds70005182) high-level device integration (ds39719) programming and diagnostics (ds39716) dual partition flash program memory (ds70005156) note 1: to access the documents listed below, browse to the documentation section of the pic24fj1024ga610/gb610 prod- uct page of the microchip web site ( www.microchip.com ) or select a family reference manual section from the following list. in addition to parameters, features and other documentation, the resulting page provides links to the related family reference manual sections. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 21 pic24fj1024ga610/gb610 family 1.0 device overview this document contains device-specific information for the following devices: the pic24fj1024ga610/gb610 family introduces many new analog features to the extreme low-power microchip devices. this is a 16-bit microcontroller family with a broad peripheral feature set and enhanced computational performance. this family also offers a new migration option for those high-performance applications which may be outgrowing their 8-bit platforms, but do not require the numerical processing power of a digital signal processor (dsp). table 1-3 lists the functions of the various pins shown in the pinout diagrams. 1.1 core features 1.1.1 16-bit architecture central to all pic24f devices is the 16-bit modified harvard architecture, first introduced with microchips dspic ? digital signal controllers (dscs). the pic24f cpu core offers a wide range of enhancements, such as: 16-bit data and 24-bit address paths with the ability to move information between data and memory spaces linear addressing of up to 12 mbytes (program space) and 32 kbytes (data) a 16-element working register array with built-in software stack support a 17 x 17 hardware multiplier with support for integer math hardware support for 32 by 16-bit division an instruction set that supports multiple addressing modes and is optimized for high-level languages, such as c operational performance up to 16 mips 1.1.2 power-saving technology the pic24fj1024ga610/gb610 family of devices includes retention sleep, a low-power mode with essential circuits being powered from a separate low-voltage regulator. this new low-power mode also supports the continuous operation of the low-power, on-chip real-time clock/ calendar (rtcc), making it possible for an application to keep time while the device is otherwise asleep. aside from this new feature, pic24fj1024ga610/gb610 family devices also include all of the legacy power-saving features of previous pic24f microcontrollers, such as: on-the-fly clock switching, allowing the selection of a lower power clock during run time doze mode operation, for maintaining peripheral clock speed while slowing the cpu clock instruction-based power-saving modes, for quick invocation of the idle and the sleep modes 1.1.3 oscillator options and features all of the devices in the pic24fj1024ga610/gb610 family offer six different oscillator options, allowing users a range of choices in developing application hardware. these include: two crystal modes two external clock (ec) modes a phase-locked loop (pll) frequency multiplier, which allows clock speeds of up to 32 mhz a digitally controlled oscillator (dco) with multiple frequencies and fast wake-up time a fast internal oscillator (frc), a nominal 8 mhz output, with multiple frequency divider options a separate low-power internal rc oscillator (lprc), 31 khz nominal, for low-power, timing-insensitive applications. the internal oscillator block also provides a stable reference source for the fail-safe clock monitor (fscm). this option constantly monitors the main clock source against a reference signal provided by the inter- nal oscillator and enables the controller to switch to the internal oscillator, allowing for continued low-speed operation or a safe application shutdown. 1.1.4 easy migration regardless of the memory size, all devices share the same rich set of peripherals, allowing for a smooth migration path as applications grow and evolve. the consistent pinout scheme used throughout the entire family also aids in migrating from one device to the next larger device, or even in jumping from 64-pin to 100-pin devices. the pic24f family is pin-compatible with devices in the dspic33 family, and shares some compatibility with the pinout schema for pic18 and dspic30. this extends the ability of applications to grow from the relatively simple, to the powerful and complex, yet still selecting a microchip device. pic24fj1024gb610 pic24fj1024ga610 pic24fj512gb610 pic24fj512ga610 pic24fj256gb610 pic24fj256ga610 pic24fj128gb610 pic24fj128ga610 pic24fj1024gb606 pic24fj1024ga606 pic24fj512gb606 pic24fj512ga606 pic24fj256gb606 pic24fj256ga606 pic24fj128gb606 pic24fj128ga606 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 22 ? 2015 microchip technology inc. 1.2 dma controller pic24fj1024ga610/gb610 fam ily devices have a direct memory access (dma) controller. this module acts in concert with the cpu, allowing data to move between data memory and peripherals without the intervention of the cpu, increasing data throughput and decreasing exe- cution time overhead. eight independently programmable channels make it possible to service multiple peripherals at virtually the same time, with each channel peripheral performing a different operation. many types of data transfer operations are supported. 1.3 other special features peripheral pin select: the peripheral pin select (pps) feature allows most digital peripherals to be mapped over a fixed set of digital i/o pins. users may independently map the input and/or output of any one of the many digital peripherals to any one of the i/o pins. configurable logic cell: the configurable logic cell (clc) module allows the user to specify combinations of signals as inputs to a logic function and to use the logic output to control other peripherals or i/o pins. timing modules: the pic24fj1024ga610/gb610 family provides five independent, general purpose, 16-bit timers (four of which can be combined into two 32-bit timers). the devices also include 3 multiple output and 4 single output advanced capture/compare/pwm/timer peripherals, and 6 independent legacy input capture and 6 independent legacy output compare modules. communications: the pic24fj1024ga610/ gb610 family incorporates a range of serial communication peripherals to handle a range of application requirements. there are 3 independent i 2 c modules that support both master and slave modes of operation. devices also have, through the pps feature, 6 independent uarts with built-in irda ? encoders/decoders and 3 spi modules. analog features: all members of the pic24fj1024ga610/gb610 family include the new 12-bit a/d converter (a/d) module and a triple comparator module. the a/d module incor- porates a range of new features that allow the converter to assess and make decisions on incoming data, reducing cpu overhead for routine a/d conversions. the comparator module includes three analog comparators that are configurable for a wide range of operations. ctmu interface: in addition to their other analog features, members of the pic24fj1024ga610/ gb610 family include the ctmu interface module. this provides a convenient method for precision time measurement and pulse generation, and can serve as an interface for capacitive sensors. enhanced parallel master/parallel slave port: this module allows rapid and transparent access to the microcontroller data bus, and enables the cpu to directly address external data memory. the parallel port can function in master or slave mode, accommodating data widths of 4, 8 or 16 bits and address widths of up to 23 bits in master modes. real-time clock and calendar (rtcc): this module implements a full-featured clock and calendar with alarm functions in hardware, freeing up timer resources and program memory space for use of the core application. 1.4 details on individual family members devices in the pic24fj1024ga610/gb610 family are available in 64-pin, 100-pin and 121-pin packages. the general block diagram for all devices is shown in figure 1-1 . the devices are differentiated from each other in six ways: 1. flash program memory (128 kbytes for pic24fj128gx6xx devices, 256 kbytes for pic24fj256gx6xx devices, 512 kbytes for pic24fj512gx6xx devices and 1024 kbytes for pic24fj1024gx6xx devices). 2. available i/o pins and ports (53 pins on 6 ports for 64-pin devices and 85 pins on 7 ports for 100-pin and 121-pin devices). 3. available interrupt-on-change notification (ioc) inputs (53 on 64-pin devices and 85 on 100-pin and 121-pin devices). 4. available remappable pins (29 pins on 64-pin devices, 44 pins on 100-pin and 121-pin devices). 5. available usb peripheral (available on pic24fjxxxgb6xx devices; not available on pic24fjxxxga6xx devices). 6. analog input channels (16 channels for 64-pin devices and 24 channels for 100-pin and 121-pin devices). all other features for devices in this family are identical. these are summarized in table 1-1 , tab l e 1 - 2 and table 1-3 . a list of the pin features available on the pic24fj1024ga610/gb610 family devices, sorted by function, is shown in ta b l e 1 - 3 . note that this table shows the pin location of individual peripheral features and not how they are multiplexed on the same pin. this information is provided in the pinout diagrams in the beginning of this data sheet. multiplexed features are sorted by the priority given to a feature, with the highest priority peripheral being listed first. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 23 pic24fj1024ga610/gb610 family table 1-1: device features for the pi c24fj1024ga606/gb606: 64-pin devices features pic24fj128gx606 pic24fj256gx606 pic24fj512gx606 pic24fj1024gx606 operating frequency dc C 32 mhz program memory (bytes) 128k 256k 512k 1024k program memory (instructions) 44,032 88,064 176,128 352,256 data memory (bytes) 32k interrupt sources (soft vectors/ nmi traps) 103 (97/6) i/o ports ports b, c, d, e, f, g total i/o pins 53 remappable pins 29 (28 i/o, 1 input only) timers: 5 ( 1 ) total number (16-bit) 32-bit (from paired 16-bit timers) 2 input capture channels 6 ( 1 ) output compare/pwm channels 6 ( 1 ) input change notification interrupt 53 serial communications: 6 ( 1 ) uart spi (3-wire/4-wire) 3 ( 1 ) i 2 c 3 configurable logic cell (clc) 4 ( 1 ) parallel communications (epmp/psp) ye s capture/compare/pwm/timer modules 3 multiple outputs and 4 single outputs jtag boundary scan yes 12/10-bit analog-to-digital converter (a/d) module (input channels) 16 analog comparators 3 ctmu interface yes universal serial bus controller yes (pic24fj1024gb606 devices only) resets (and delays) core por, v dd por, bor, reset instruction, mclr , wdt, illegal opcode, repeat instruction, hardware traps, configuration word mismatch (ost, pll lock) instruction set 76 base instructions, multiple addressing mode variations packages 64-pin tqfp and qfn note 1: some peripherals are accessible through remappable pins. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 24 ? 2015 microchip technology inc. table 1-2: device features for the pic24f j1024gx610: 100-pin and 121-pin devices features pic24fj128gx610 pic24fj256gx610 pic24fj512gx610 pic24fj1024gx610 operating frequency dc C 32 mhz program memory (bytes) 128k 256k 512k 1024k program memory (instructions) 44,032 88,064 176,128 352,256 data memory (bytes) 32k interrupt sources (soft vectors/nmi traps) 103 (97/6) i/o ports ports a, b, c, d, e, f, g total i/o pins 85 remappable pins 44 (32 i/o, 12 input only) timers: 5 ( 1 ) total number (16-bit) 32-bit (from paired 16-bit timers) 2 capture/compare/pwm/timer modules 3 multiple outputs and 4 single outputs input capture channels 6 ( 1 ) output compare/pwm channels 6 ( 1 ) input change notification interrupt 85 serial communications: 6 ( 1 ) uart spi (3-wire/4-wire) 3 ( 1 ) i 2 c 3 configurable logic cell (clc 4 parallel communications (epmp/psp) ye s jtag boundary scan yes 12/10-bit analog-to-digital converter (a/d) module (input channels) 24 analog comparators 3 ctmu interface yes universal serial bus controller yes (pic14fj1024gb610 devices only ) resets (and delays) core por, v dd por, bor, reset instruction, mclr , wdt, illegal opcode, repeat instruction, hardware traps, configuration word mismatch (ost, pll lock) instruction set 76 base instructions, multiple addressing mode variations packages 100-pin tqfp and 121-pin bga note 1: some peripherals are accessible through remappable pins. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 25 pic24fj1024ga610/gb610 family figure 1-1: pic24fj1024ga610/gb610 family general block diagram instruction decode and control 16 pch 16 program counter 16-bit alu 23 24 data bus inst register 16 divide support inst latch 16 ea mux read agu write agu 16 16 8 interrupt controller eds and stack control logic repeat control logic data latch data ram address latch address latch extended data data latch 16 address bus literal 23 control signals 16 16 16 x 16 w reg array multiplier 17x17 osci/clki osco/clko v dd , v ss timing generation mclr power-up timer oscillator start-up timer power-on reset watchdog timer hlvd & precision reference band gap frc/lprc oscillators regulators voltage v cap porta (1) portc (1) (12 i/o) (8 i/o) portb (16 i/o) note 1: not all i/o pins or features are implemented on all device pinout configura tions. see ta b l e 1 - 3 for specific implementations by pin count. 2: bor functionality is provided when the on-board voltage regulator is enabl ed. 3: some peripheral i/os are only accessible through remappable pins. portd (1) (16 i/o) comparators (3) timer2/3 (3) timer1 rtcc ic a/d 12-bit oc/pwm spi i2c timer4/5 (3) epmp/psp 1-6 (3) iocs (1) uart refo porte (1) portg (1) (10 i/o) (12 i/o) portf (1) (11 i/o) 1-3 (3) 1-3 1-6 (3) 1-6 (3) ctmu usb driver space program memory/ clc1-4 (1) dma controller data dma data bus 16 ta b l e d a t a access control mccp1/2/3 sccp4/5/6/7 pcl bor (2) downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 26 ? 2015 microchip technology inc. table 1-3: pic24fj1024ga610/gb610 family pinout descriptions pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga an0 16 16 25 25 k2 k2 i ana a/d analog inputs an1 15 15 24 24 k1 k1 i ana an2 14 14 23 23 j2 j2 i ana an3 13 13 22 22 j1 j1 i ana an4 12 12 21 21 h2 h2 i ana an5 11 11 20 20 h1 h1 i ana an6 17 17 26 26 l1 l1 i ana an7 18 18 27 27 j3 j3 i ana an8 21 21 32 32 k4 k4 i ana an9 22 22 33 33 l4 l4 i ana an10 23 23 34 34 l5 l5 i ana an11 24 24 35 35 j5 j5 i ana an12 27 27 41 41 j7 j7 i ana an13 28 28 42 42 l7 l7 i ana an14 29 29 43 43 k7 k7 i ana an15 30 30 44 44 l8 l8 i ana an16 9 9 e1 e1 i ana an17 10 10 e3 e3 i ana an18 11 11 f4 f4 i ana an19 12 12 f2 f2 i ana an20 14 14 f3 f3 i ana an21 19 19 g2 g2 i ana an22 92 92 b5 b5 i ana an23 91 91 c5 c5 i ana av dd 19 19 30 30 j4 j4 p positive supply for analog modules av ss 20 20 31 31 l3 l3 p ground reference for analog modules c1ina 11 11 20 20 h1 h1 i ana comparator 1 input a c1inb 12 12 21 21 h2 h2 i ana comparator 1 input b c1inc 5,8 5,8 11,14 11,14 f4,f3 f4,f3 i ana comparator 1 input c c1ind 4 4 10 10 e3 e3 i ana comparator 1 input d c2ina 13 13 22 22 j1 j1 i ana comparator 2 input a c2inb 14 14 23 23 j2 j2 i ana comparator 2 input b c2inc 8 8 14 14 f3 f3 i ana comparator 2 input c c2ind 6 6 12 12 f2 f2 i ana comparator 2 input d c3ina 55 55 84 84 c7 c7 i ana comparator 3 input a legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 27 pic24fj1024ga610/gb610 family c3inb 54 54 83 83 d7 d7 i ana comparator 3 input b c3inc 8,48 8,48 14,74 14,74 f3,b11 f3,b11 i ana comparator 3 input c c3ind 47 47 73 73 c10 c10 i ana comparator 3 input d clc3out 46 46 72 72 d9 d9 o dig clc3 output clc4out 42 42 68 68 e9 e9 o dig clc4 output clki 39 39 63 63 f9 f9 main clock input connection clko 40 40 64 64 f11 f11 o dig system clock output ctcmp 14 14 23 23 j2 j2 o ana ctmu comparator 2 input (pulse mode) cted1 28 28 42 42 l7 l7 i st ctmu external edge inputs cted2 27 27 41 41 j7 j7 i st cted3 1 1 b2 b2 i st cted4 1 1 3 3 d3 d3 i st cted5 29 29 43 43 k7 k7 i st cted6 30 30 44 44 l8 l8 i st cted7 40 40 k6 k6 i st cted8 64 64 100 100 a1 a1 i st cted9 63 63 99 99 a2 a2 i st cted10 97 97 a3 a3 i st cted11 95 95 c4 c4 i st cted12 15 15 24 24 k1 k1 i st cted13 14 14 23 23 j2 j2 i st cted14 17 17 g3 g3 i st ctpls 29 29 43 43 k7 k7 o dig ctmu pulse output cv ref 23 23 34 34 l5 l5 o ana comparator voltage reference output cv ref + 16 16 25,29 25,29 k2,k3 k2,k3 i ana comparator voltage reference (high) input cv ref - 15 15 24,28 24,28 k1,l2 k1,l2 i ana comparator voltage reference (low) input d+ 37 57 h10 i/o xcvr usb signaling d- 36 56 j11 i/o xcvr table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 28 ? 2015 microchip technology inc. ic4 1 1 3 3 d3 d3 i st input capture ic5 2 2 4 4 c1 c1 i st ic6 3 3 5 5 d2 d2 i st icm1 4 4 10 10 12 12 i st mccp1 input capture icm2 6 6 12 12 14 14 i st mccp2 input capture icm3 11 11 20 20 23 23 i st mccp3 input capture icm4 49 49 76 76 91 91 i st sccp4 input capture icm5 42 42 68 68 80 80 i st sccp5 input capture icm6 46 46 72 72 86 86 i st sccp6 input capture icm7 51 51 78 78 93 93 i st sccp7 input capture int0 35 46 55 72 h9 d9 i st external interrupt input 0 ioca0 17 17 g3 g3 i st porta interrupt-on-change ioca1 38 38 j6 j6 i st ioca2 58 58 h11 h11 i st ioca3 59 59 g10 g10 i st ioca4 60 60 g11 g11 i st ioca5 61 61 g9 g9 i st ioca6 91 91 c5 c5 i st ioca7 92 92 b5 b5 i st ioca9 28 28 l2 l2 i st ioca10 29 29 k3 k3 i st ioca14 66 66 e11 e11 i st ioca15 67 67 e8 e8 i st table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 29 pic24fj1024ga610/gb610 family iocb0 16 16 25 25 k2 k2 i st portb interrupt-on-change iocb1 15 15 24 24 k1 k1 i st iocb2 14 14 23 23 j2 j2 i st iocb3 13 13 22 22 j1 j1 i st iocb4 12 12 21 21 h2 h2 i st iocb5 11 11 20 20 h1 h1 i st iocb6 17 17 26 26 l1 l1 i st iocb7 18 18 27 27 j3 j3 i st iocb8 21 21 32 32 k4 k4 i st iocb9 22 22 33 33 l4 l4 i st iocb10 23 23 34 34 l5 l5 i st iocb11 24 24 35 35 j5 j5 i st iocb12 27 27 41 41 j7 j7 i st iocb13 28 28 42 42 l7 l7 i st iocb14 29 29 43 43 k7 k7 i st iocb15 30 30 44 44 l8 l8 i st iocc1 6 6 d1 d1 i st portc interrupt-on-change iocc2 7 7 e4 e4 i st iocc3 8 8 e2 e2 i st iocc4 9 9 e1 e1 i st iocc12 39 39 63 63 f9 f9 i st iocc13 47 47 73 73 c10 c10 i st iocc14 48 48 74 74 b11 b11 i st iocc15 40 40 64 64 f11 f11 i st table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 30 ? 2015 microchip technology inc. iocd0 46 46 72 72 d9 d9 i st portd interrupt-on-change iocd1 49 49 76 76 a11 a11 i st iocd2 50 50 77 77 a10 a10 i st iocd3 51 51 78 78 b9 b9 i st iocd4 52 52 81 81 c8 c8 i st iocd5 53 53 82 82 b8 b8 i st iocd6 54 54 83 83 d7 d7 i st iocd7 55 55 84 84 c7 c7 i st iocd8 42 42 68 68 e9 e9 i st iocd9 43 43 69 69 e10 e10 i st iocd10 44 44 70 70 d11 d11 i st iocd11 45 45 71 71 c11 c11 i st iocd12 79 79 a9 a9 i st iocd13 80 80 d8 d8 i st iocd14 47 47 l9 l9 i st iocd15 48 48 k9 k9 i st ioce0 60 60 93 93 a4 a4 i st porte interrupt-on-change ioce1 61 61 94 94 b4 b4 i st ioce2 62 62 98 98 b3 b3 i st ioce3 63 63 99 99 a2 a2 i st ioce4 64 64 100 100 a1 a1 i st ioce5 1 1 3 3 d3 d3 i st ioce6 2 2 4 4 c1 c1 i st ioce7 3 3 5 5 d2 d2 i st ioce8 18 18 g1 g1 i st ioce9 19 19 g2 g2 i st table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 31 pic24fj1024ga610/gb610 family iocf0 58 58 87 87 b6 b6 i st portf interrupt-on-change iocf1 59 59 88 88 a6 a6 i st iocf2 34 52 52 k11 k11 i st iocf3 33 33 51 51 k10 k10 i st iocf4 31 31 49 49 l10 l10 i st iocf5 32 32 50 50 l11 l11 i st iocf6 35 55 h9 i st iocf7 34 54 54 h8 h8 i st iocf8 53 53 j10 j10 i st iocf12 40 40 k6 k6 i st iocf13 39 39 l6 l6 i st iocg0 90 90 a5 a5 i st portg interrupt-on-change iocg1 89 89 e6 e6 i st iocg2 37 37 57 57 h10 h10 i st iocg3 36 36 56 56 j11 j11 i st iocg6 4 4 10 10 e3 e3 i st iocg7 5 5 11 11 f4 f4 i st iocg8 6 6 12 12 f2 f2 i st iocg9 8 8 14 14 f3 f3 i st iocg12 96 96 c3 c3 i st iocg13 97 97 a3 a3 i st iocg14 95 95 c4 c4 i st iocg15 1 1 b2 b2 i st hlvdin 64 64 100 100 a1 a1 i ana high/low-voltage detect input mclr 7 7 13 13 f1 f1 i st master clear (device reset) input. this line is brought low to cause a reset. oc4 54 54 83 83 d7 d7 o dig output compare outputs oc5 55 55 84 84 c7 c7 o dig oc6 58 58 87 87 b6 b6 o dig ocm1a 4 4 10 10 e3 e3 o dig mccp1 outputs ocm1b 5 5 11 11 f4 f4 o dig ocm1c 1 1 b2 b2 o dig ocm1d 6 6 d1 d1 o dig ocm1e 91 91 c5 c5 o dig ocm1f 92 92 b5 b5 o dig table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 32 ? 2015 microchip technology inc. ocm2a 6 6 12 12 f2 f2 o dig mccp2 outputs ocm2b 8 8 14 14 f3 f3 o dig ocm2c 7 7 e4 e4 o dig ocm2d 8 8 e2 e2 o dig ocm2e 96 96 c3 c3 o dig ocm2f 97 97 a3 a3 o dig ocm3a 11 11 20 20 h1 h1 o dig mccp3 outputs ocm3b 12 12 21 21 h2 h2 o dig ocm3c 9 9 e1 e1 o dig ocm3d 17 17 g3 g3 o dig ocm3e 79 79 a9 a9 o dig ocm3f 80 80 d8 d8 o dig osci 39 39 63 63 f9 f9 i ana/ st main oscillator input connection osco 40 40 64 64 f11 f11 o ana main oscillator output connection pgec1 15 15 24 24 k1 k1 i st icsp? programming clock pgec2 17 17 26 26 l1 l1 i st pgec3 11 11 20 20 h1 h1 i st pged1 16 16 25 25 k2 k2 i/o dig/st icsp programming data pged2 18 18 27 27 j3 j3 i/o dig/st pged3 12 12 21 21 h2 h2 i/o dig/st pma0/ pmall 30 30 44 44 l8 l8 i/o dig/ st/ttl parallel master port address<0>/ address latch low pma1/ pmalh 29 29 43 43 k7 k7 i/o dig/ st/ttl parallel master port address<1>/ address latch high pma14/ pmcs1 45 45 71 71 c11 c11 i/o dig/ st/ttl parallel master port address<14>/ slave chip select/chip select 1 strobe pma15/ pmcs2 44 44 70 70 d11 d11 i/o dig/ st/ttl parallel master port address<15>/ chip select 2 strobe pma6 16 16 29 29 k3 k3 o dig parallel master port address pma7 22 22 28 28 l2 l2 o dig table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 33 pic24fj1024ga610/gb610 family pma8 32 32 50 50 l11 l11 i/o dig/ st/ttl parallel master port address (demultiplexed master mode) or address/data (multiplexed master modes) pma9 31 31 49 49 l10 l10 i/o dig/ st/ttl pma10 28 28 42 42 l7 l7 i/o dig/ st/ttl pma11 27 27 41 41 j7 j7 i/o dig/ st/ttl pma12 24 24 35 35 j5 j5 i/o dig/ st/ttl pma13 23 23 34 34 l5 l5 i/o dig/ st/ttl pma16 95 95 c4 c4 o dig pma17 92 92 b5 b5 o dig pma18 40 40 k6 k6 o dig pma19 19 19 g2 g2 o dig pma2/ pmalu 8 8 14 14 f3 f3 o dig parallel master port address<2>/ address latch upper pma3 6 6 12 12 f2 f2 o dig parallel master port address pma4 5 5 11 11 f4 f4 o dig pma5 4 4 10 10 e3 e3 o dig pma20 59 59 g10 g10 o dig parallel master port address (demultiplexed master mode) or address/data (multiplexed master modes) pma21 60 60 g11 g11 o dig pma22 66 66 e11 e11 o dig pmack1 50 50 77 77 a10 a10 i st/ttl parallel master port acknowledge input 1 pmack2 43 43 69 69 e10 e10 i st/ttl parallel master port acknowledge input 2 pmbe0 51 51 78 78 b9 b9 o dig parallel master port byte enable 0 strobe pmbe1 67 67 e8 e8 o dig parallel master port byte enable 1 strobe pmcs1 18 18 g1 g1 o dig parallel master port chip select 1 strobe pmcs2 9 9 e1 e1 o dig parallel master port chip select 2 strobe pmpcs1 58 58 h11 h11 o dig parallel master port chip select 1 table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 34 ? 2015 microchip technology inc. pmd0 60 60 93 93 a4 a4 i/o dig/ st/ttl parallel master port data (demultiplexed master mode) or address/data (multiplexed master modes) pmd1 61 61 94 94 b4 b4 i/o dig/ st/ttl pmd2 62 62 98 98 b3 b3 i/o dig/ st/ttl pmd3 63 63 99 99 a2 a2 i/o dig/ st/ttl pmd4 64 64 100 100 a1 a1 i/o dig/ st/ttl pmd5 1 1 3 3 d3 d3 i/o dig/ st/ttl pmd6 2 2 4 4 c1 c1 i/o dig/ st/ttl pmd7 3 3 5 5 d2 d2 i/o dig/ st/ttl pmd8 90 90 a5 a5 i/o dig/ st/ttl pmd9 89 89 e6 e6 i/o dig/ st/ttl pmd10 88 88 a6 a6 i/o dig/ st/ttl pmd11 87 87 b6 b6 i/o dig/ st/ttl pmd12 79 79 a9 a9 i/o dig/ st/ttl pmd13 80 80 d8 d8 i/o dig/ st/ttl pmd14 83 83 d7 d7 i/o dig/ st/ttl pmd15 84 84 c7 c7 i/o dig/ st/ttl pmrd/ pmwr 53 53 82 82 b8 b8 i/o dig/ st/ttl parallel master port read strobe/write strobe pmwr/ pmenb 52 52 81 81 c8 c8 i/o dig/ st/ttl parallel master port write strobe/enable strobe pwrgt 21 21 32 32 k4 k4 o dig real-time clock power control output pwrlclk 48 48 74 74 b11 b11 i st real-time clock 50/60 hz clock input table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 35 pic24fj1024ga610/gb610 family ra0 17 17 g3 g3 i/o dig/st porta digital i/os ra1 38 38 j6 j6 i/o dig/st ra2 58 58 h11 h11 i/o dig/st ra3 59 59 g10 g10 i/o dig/st ra4 60 60 g11 g11 i/o dig/st ra5 61 61 g9 g9 i/o dig/st ra6 91 91 c5 c5 i/o dig/st ra7 92 92 b5 b5 i/o dig/st ra9 28 28 l2 l2 i/o dig/st ra10 29 29 k3 k3 i/o dig/st ra14 66 66 e11 e11 i/o dig/st ra15 67 67 e8 e8 i/o dig/st rb0 16 16 25 25 k2 k2 i/o dig/st portb digital i/os rb1 15 15 24 24 k1 k1 i/o dig/st rb2 14 14 23 23 j2 j2 i/o dig/st rb3 13 13 22 22 j1 j1 i/o dig/st rb4 12 12 21 21 h2 h2 i/o dig/st rb5 11 11 20 20 h1 h1 i/o dig/st rb6 17 17 26 26 l1 l1 i/o dig/st rb7 18 18 27 27 j3 j3 i/o dig/st rb8 21 21 32 32 k4 k4 i/o dig/st rb9 22 22 33 33 l4 l4 i/o dig/st rb10 23 23 34 34 l5 l5 i/o dig/st rb11 24 24 35 35 j5 j5 i/o dig/st rb12 27 27 41 41 j7 j7 i/o dig/st rb13 28 28 42 42 l7 l7 i/o dig/st rb14 29 29 43 43 k7 k7 i/o dig/st rb15 30 30 44 44 l8 l8 i/o dig/st rc1 6 6 d1 d1 i/o dig/st portc digital i/os rc2 7 7 e4 e4 i/o dig/st rc3 8 8 e2 e2 i/o dig/st rc4 9 9 e1 e1 i/o dig/st rc12 39 39 63 63 f9 f9 i/o dig/st rc13 47 47 73 73 c10 c10 i/o dig/st rc14 48 48 74 74 b11 b11 i/o dig/st rc15 40 40 64 64 f11 f11 i/o dig/st table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 36 ? 2015 microchip technology inc. rd0 46 46 72 72 d9 d9 i/o dig/st portd digital i/os rd1 49 49 76 76 a11 a11 i/o dig/st rd2 50 50 77 77 a10 a10 i/o dig/st rd3 51 51 78 78 b9 b9 i/o dig/st rd4 52 52 81 81 c8 c8 i/o dig/st rd5 53 53 82 82 b8 b8 i/o dig/st rd6 54 54 83 83 d7 d7 i/o dig/st rd7 55 55 84 84 c7 c7 i/o dig/st rd8 42 42 68 68 e9 e9 i/o dig/st rd9 43 43 69 69 e10 e10 i/o dig/st rd10 44 44 70 70 d11 d11 i/o dig/st rd11 45 45 71 71 c11 c11 i/o dig/st rd12 79 79 a9 a9 i/o dig/st rd13 80 80 d8 d8 i/o dig/st rd14 47 47 l9 l9 i/o dig/st rd15 48 48 k9 k9 i/o dig/st re0 60 60 93 93 a4 a4 i/o dig/st porte digital i/os re1 61 61 94 94 b4 b4 i/o dig/st re2 62 62 98 98 b3 b3 i/o dig/st re3 63 63 99 99 a2 a2 i/o dig/st re4 64 64 100 100 a1 a1 i/o dig/st re5 1 1 3 3 d3 d3 i/o dig/st re6 2 2 4 4 c1 c1 i/o dig/st re7 3 3 5 5 d2 d2 i/o dig/st re8 18 18 g1 g1 i/o dig/st re9 19 19 g2 g2 i/o dig/st refi 24 24 35 35 j5 j5 i st reference clock input table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 37 pic24fj1024ga610/gb610 family rf0 58 58 87 87 b6 b6 i/o dig/st portf digital i/os rf1 59 59 88 88 a6 a6 i/o dig/st rf2 34 52 52 k11 k11 i/o dig/st rf3 33 33 51 51 k10 k10 i/o dig/st rf4 31 31 49 49 l10 l10 i/o dig/st rf5 32 32 50 50 l11 l11 i/o dig/st rf6 35 55 h9 i/o dig/st rf7 34 54 54 h8 h8 i/o dig/st rf8 53 53 j10 j10 i/o dig/st rf12 40 40 k6 k6 i/o dig/st rf13 39 39 l6 l6 i/o dig/st rg0 90 90 a5 a5 i/o dig/st portg digital i/os rg1 89 89 e6 e6 i/o dig/st rg2 37 37 57 57 h10 h10 i/o dig/st rg3 36 36 56 56 j11 j11 i/o dig/st rg6 4 4 10 10 e3 e3 i/o dig/st rg7 5 5 11 11 f4 f4 i/o dig/st rg8 6 6 12 12 f2 f2 i/o dig/st rg9 8 8 14 14 f3 f3 i/o dig/st rg12 96 96 c3 c3 i/o dig/st rg13 97 97 a3 a3 i/o dig/st rg14 95 95 c4 c4 i/o dig/st rg15 1 1 b2 b2 i/o dig/st table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 38 ? 2015 microchip technology inc. rp0 16 16 25 25 k2 k2 i/o dig/st remappable peripherals (input or output) rp1 15 15 24 24 k1 k1 i/o dig/st rp2 42 42 68 68 e9 e9 i/o dig/st rp3 44 44 70 70 d11 d11 i/o dig/st rp4 43 43 69 69 e10 e10 i/o dig/st rp5 48 48 k9 k9 i/o dig/st rp6 17 17 26 26 l1 l1 i/o dig/st rp7 18 18 27 27 j3 j3 i/o dig/st rp8 21 21 32 32 k4 k4 i/o dig/st rp9 22 22 33 33 l4 l4 i/o dig/st rp10 31 31 49 49 l10 l10 i/o dig/st rp11 46 46 72 72 d9 d9 i/o dig/st rp12 45 45 71 71 c11 c11 i/o dig/st rp13 14 14 23 23 j2 j2 i/o dig/st rp14 29 29 43 43 k7 k7 i/o dig/st rp15 53 53 j10 j10 i/o dig/st rp16 33 33 51 51 k10 k10 i/o dig/st rp17 32 32 50 50 l11 l11 i/o dig/st rp18 11 11 20 20 h1 h1 i/o dig/st rp19 6 6 12 12 f2 f2 i/o dig/st rp20 53 53 82 82 b8 b8 i/o dig/st rp21 4 4 10 10 e3 e3 i/o dig/st rp22 51 51 78 78 b9 b9 i/o dig/st rp23 50 50 77 77 a10 a10 i/o dig/st rp24 49 49 76 76 a11 a11 i/o dig/st rp25 52 52 81 81 c8 c8 i/o dig/st rp26 5 5 11 11 f4 f4 i/o dig/st rp27 8 8 14 14 f3 f3 i/o dig/st rp28 12 12 21 21 h2 h2 i/o dig/st rp29 30 30 44 44 l8 l8 i/o dig/st rp30 34 52 52 k11 k11 i/o dig/st rp31 39 39 l6 l6 i/o dig/st table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 39 pic24fj1024ga610/gb610 family rpi32 40 40 k6 k6 i dig/st remappable peripherals (input only) rpi33 18 18 g1 g1 i dig/st rpi34 19 19 g2 g2 i dig/st rpi35 67 67 e8 e8 i dig/st rpi36 66 66 e11 e11 i dig/st rpi37 48 48 74 74 b11 b11 i dig/st rpi38 6 6 d1 d1 i dig/st rpi39 7 7 e4 e4 i dig/st rpi40 8 8 e2 e2 i dig/st rpi41 9 9 e1 e1 i dig/st rpi42 79 79 a9 a9 i dig/st rpi43 47 47 l9 l9 i dig/st scl1 37 44 57 66 h10 e11 i/o i 2 c i2c1 synchronous serial clock input/output scl2 32 32 58 58 h11 h11 i/o i 2 c i2c2 synchronous serial clock input/output scl3 2 2 4 4 c1 c1 i/o i 2 c i2c3 synchronous serial clock input/output sda1 36 43 56 67 j11 e8 i/o i 2 c i2c1 data input/output sda2 31 31 59 59 g10 g10 i/o i 2 c i2c2 data input/output sda3 3 3 5 5 d2 d2 i/o i 2 c i2c3 data input/output sosci 47 47 73 73 c10 c10 i ana/ st secondary oscillator/timer1 clock input sosco 48 48 74 74 b11 b11 o ana secondary oscillator/timer1 clock output t1ck 22 22 33 33 l4 l4 i st timer1 clock tck 27 27 38 38 j6 j6 i st jtag test clock/programming clock input tdi 28 28 60 60 g11 g11 i st jtag test data/programming data input tdo 24 24 61 61 g9 g9 o dig jtag test data output tmpr 22 22 33 33 l4 l4 i st tamper detect input tms 23 23 17 17 g3 g3 i st jtag test mode select input u5cts 58 58 87 87 b6 b6 i st uart5 cts output u5rts / u5bclk 55 55 84 84 c7 c7 o dig uart5 rts input u5rx 54 54 83 83 d7 d7 i st uart5 receive input u5tx 49 49 76 76 a11 a11 o dig uart5 transmit output u6cts 46 46 72 72 d9 d9 i st uart6 cts output u6rts / u6bclk 42 42 68 68 e9 e9 o dig uart6 rts input table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 40 ? 2015 microchip technology inc. u6rx 27 27 41 41 j7 j7 i st uart6 receive input u6tx 18 18 27 27 j3 j3 o dig uart6 transmit output usbid 33 51 k10 i st usb otg id input usboen 12 21 h2 o dig usb output enable (active-low) v bus 3 45 4h 8 i v bus supply detect v cap 56 56 85 85 b7 b7 p external filter capacitor connection (regulator enabled) v dd 10,26,38 10,26,38 2,16,37, 46,62 2,16,37, 46,62 c2,f8, g5,h6, k8 c2,f8, g5,h6, k8 p positive supply for peripheral digital logic and i/o pins v ref + 16 16 25,29 25,29 k2,k3 k2,k3 i ana comparator and a/d reference voltage (high) input v ref - 15 15 24,28 24,28 k1,l2 k1,l2 i ana comparator and a/d reference voltage (low) input v ss 9,25,41 9,25,41 15,36,45, 65,75 15,36,45, 65,75 b10,f5, f10,g6, g7 b10,f5, f10,g6, g7 p ground reference for peripheral digital logic and i/o pins v usb3v3 3 55 5h 9 p 3 . 3 v v usb table 1-3: pic24fj1024ga610/gb610 fami ly pinout descriptions (continued) pin function pin number/grid locator i/o input buffer description ga606 64-pin qfn/tqfp/ qfp gb606 64-pin qfn/ tqfp/qfp ga610 100-pin tqfp/ qfp gb610 100-pin tqfp/ qfp ga612 121-pin bga gb612 121-pin bga legend: ttl = ttl input buffer st = schmitt trigger input buffer ana = analog level input/output i 2 c = i 2 c/smbus input buffer dig = digital input/output xcvr = dedicated transceiver downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 41 pic24fj1024ga610/gb610 family 2.0 guidelines for getting started with 16-bit microcontrollers 2.1 basic connection requirements getting started with the pic24fj1024ga610/gb610 family of 16-bit microcontrollers requires attention to a minimal set of device pin connections before proceeding with development. the following pins must always be connected: all v dd and v ss pins (see section 2.2 power supply pins ) the usb transceiver supply, v usb3v3 , regardless of whether or not the usb module is used (see section 2.2 power supply pins ) all av dd and av ss pins, regardless of whether or not the analog device features are used (see section 2.2 power supply pins ) mclr pin (see section 2.3 master clear (mclr) pin ) v cap pin (pic24f j devices only) (see section 2.4 voltage regulator pin (v cap ) ) these pins must also be connected if they are being used in the end application: pgecx/pgedx pins used for in-circuit serial programming? (icsp?) and debugging purposes (see section 2.5 icsp pins ) osci and osco pins when an external oscillator source is used (see section 2.6 external oscillator pins ) additionally, the following pins may be required: v ref +/v ref - pins used when external voltage reference for analog modules is implemented the minimum mandatory connections are shown in figure 2-1 . figure 2-1: recommended minimum connections note: the av dd and av ss pins must always be connected, regardless of whether any of the analog modules are being used. pic24fjxxxx v dd v ss v dd v ss v ss v dd av dd av ss v dd v ss c1 r1 v dd mclr v cap r2 c7 c2 (2) c3 (2) c4 (2) c5 (2) c6 (2) key (all values are recommendations): c1 through c6: 0.1 ? f, 50v ceramic c7: 10 ? f, 16v or greater, ceramic r1: 10 k ? r2: 100 ? to 470 ? note 1: see section 2.4 voltage regulator pin (v cap ) for an explanation of voltage regulator pin connections. 2: the example shown is for a pic24f device with five v dd /v ss and av dd /av ss pairs. other devices may have more or less pairs; adjust the number of decoupling capacitors appropriately. (1) downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 42 ? 2015 microchip technology inc. 2.2 power supply pins 2.2.1 decoupling capacitors the use of decoupling capacitors on every pair of power supply pins, such as v dd , v ss , av dd and av ss , is required. consider the following criteria when using decoupling capacitors: value and type of capacitor: a 0.1 ? f (100 nf), 16v-50v capacitor is recommended. the capacitor should be a low-esr device with a self-resonance frequency in the range of 200 mhz and higher. ceramic capacitors are recommended. placement on the printed circuit board: the decoupling capacitors should be placed as close to the pins as possible. it is recommended to place the capacitors on the same side of the board as the device. if space is constricted, the capacitor can be placed on another layer on the pcb using a via; however, ensure that the trace length from the pin to the capacitor is no greater than 0.25 inch (6 mm). handling high-frequency noise: if the board is experiencing high-frequency noise (upward of tens of mhz), add a second ceramic type capaci- tor in parallel to the above described decoupling capacitor. the value of the second capacitor can be in the range of 0.01 ? f to 0.001 ? f. place this second capacitor next to each primary decoupling capacitor. in high-speed circuit designs, consider implementing a decade pair of capacitances as close to the power and ground pins as possible (e.g., 0.1 ? f in parallel with 0.001 ? f). maximizing performance: on the board layout from the power supply circuit, run the power and return traces to the decoupling capacitors first, and then to the device pins. this ensures that the decoupling capacitors are first in the power chain. equally important is to keep the trace length between the capacitor and the power pins to a minimum, thereby reducing pcb trace inductance. 2.2.2 tank capacitors on boards with power traces running longer than six inches in length, it is suggested to use a tank capacitor for integrated circuits including microcontrollers to supply a local power source. the value of the tank capacitor should be determined based on the trace resistance that connects the power supply source to the device, and the maximum current drawn by the device in the application. in other words, select the tank capacitor so that it meets the acceptable voltage sag at the device. typical values range from 4.7 ? f to 47 ? f. 2.3 master clear (mclr ) pin the mclr pin provides two specific device functions: device reset, and device programming and debug- ging. if programming and debugging are not required in the end application, a direct connection to v dd may be all that is required. the addition of other components, to help increase the applications resistance to spurious resets from voltage sags, may be beneficial. a typical configuration is shown in figure 2-1 . other circuit designs may be implemented depending on the applications requirements. during programming and debugging, the resistance and capacitance that can be added to the pin must be considered. device programmers and debuggers drive the mclr pin. consequently, specific voltage levels (v ih and v il ) and fast signal transitions must not be adversely affected. therefore, specific values of r1 and c1 will need to be adjusted based on the application and pcb requirements. for example, it is recommended that the capacitor, c1, be isolated from the mclr pin during programming and debug- ging operations by using a jumper ( figure 2-2 ). the jumper is replaced for normal run-time operations. any components associated with the mclr pin should be placed within 0.25 inch (6 mm) of the pin. figure 2-2: example of mclr pin connections note 1: r1 ? 10 k ? is recommended. a suggested starting value is 10 k ? . ensure that the mclr pin v ih and v il specifications are met. 2: r2 ? 470 ? will limit any current flowing into mclr from the external capacitor, c, in the event of a mclr pin breakdown, due to electrostatic discharge (esd) or electrical overstress (eos). ensure that the mclr pin v ih and v il specifications are met. c1 r2 r1 v dd mclr pic24fxxxx jp downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 43 pic24fj1024ga610/gb610 family 2.4 voltage regulator pin (v cap ) refer to section 30.3 on-chip voltage regulator for details on connecting and using the on-chip regulator. a low-esr (< 5 ? ) capacitor is required on the v cap pin to stabilize the voltage regulator output voltage. the v cap pin must not be connected to v dd and must use a capacitor of 10 f connected to ground. the type can be ceramic or tantalum. suitable examples of capacitors are shown in table 2-1 . capacitors with equivalent specifications can be used. designers may use figure 2-3 to evaluate the esr equivalence of candidate devices. the placement of this capacitor should be close to v cap . it is recommended that the trace length not exceed 0.25 inch (6 mm). refer to section 33.0 electrical characteristics for additional information. figure 2-3: frequency vs. esr performance for suggested v cap . note: this section applies only to pic24fj devices with an on-chip voltage regulator. 10 1 0.1 0.01 0.001 0.01 0.1 1 10 100 1000 10,000 frequency (mhz) esr ( ? ) note: typical data measurement at +25c, 0v dc bias. table 2-1: suitable capacitor equivalents (0805 case size) make part # nominal capacitance base tolerance rated voltage tdk c2012x5r1e106k085ac 10 f 10% 25v tdk c2012x5r1c106k085ac 10 f 10% 16v kemet c0805c106m4pactu 10 f 10% 16v murata grm21br61e106ka3l 10 f 10% 25v murata grm21br61c106ke15 10 f 10% 16v downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 44 ? 2015 microchip technology inc. 2.4.1 considerations for ceramic capacitors in recent years, large value, low-voltage, surface-mount ceramic capacitors have become very cost effective in sizes up to a few tens of microfarad. the low-esr, small physical size and other properties make ceramic capacitors very attractive in many types of applications. ceramic capacitors are suitable for use with the inter- nal voltage regulator of this microcontroller. however, some care is needed in selecting the capacitor to ensure that it maintains sufficient capacitance over the intended operating range of the application. typical low-cost, 10 ? f ceramic capacitors are available in x5r, x7r and y5v dielectric ratings (other types are also available, but are less common). the initial tolerance specifications for these types of capacitors are often specified as 10% to 20% (x5r and x7r) or -20%/ +80% (y5v). however, the effective capacitance that these capacitors provide in an application circuit will also vary based on additional factors, such as the applied dc bias voltage and the temperature. the total in-circuit tol- erance is, therefore, much wider than the initial tolerance specification. the x5r and x7r capacitors typically exhibit satisfac- tory temperature stability (ex: 15% over a wide temperature range, but consult the manufacturers data sheets for exact specifications). however, y5v capaci- tors typically have extreme temperature tolerance specifications of +22%/-82%. due to the extreme temperature tolerance, a 10 ? f nominal rated y5v type capacitor may not deliver enough total capacitance to meet minimum internal voltage regulator stability and transient response requirements. therefore, y5v capacitors are not recommended for use with the internal regulator if the application must operate over a wide temperature range. in addition to temperature tolerance, the effective capacitance of large value ceramic capacitors can vary substantially, based on the amount of dc voltage applied to the capacitor. this effect can be very signifi- cant, but is often overlooked or is not always documented. a typical dc bias voltage vs. capacitance graph for x7r type capacitors is shown in figure 2-4 . figure 2-4: dc bias voltage vs. capacitance characteristics when selecting a ceramic capacitor to be used with the internal voltage regulator, it is suggested to select a high-voltage rating so that the operating voltage is a small percentage of the maximum rated capacitor volt- age. for example, choose a ceramic capacitor rated at a minimum of 16v for the 1.8v core voltage. suggested capacitors are shown in table 2-1 . 2.5 icsp pins the pgecx and pgedx pins are used for in-circuit serial programming (icsp) and debugging purposes. it is recommended to keep the trace length between the icsp connector and the icsp pins on the device as short as possible. if the icsp connector is expected to experience an esd event, a series resistor is recom- mended, with the value in the range of a few tens of ohms, not to exceed 100 ? . pull-up resistors, series diodes and capacitors on the pgecx and pgedx pins are not recommended as they will interfere with the programmer/debugger communi- cations to the device. if such discrete components are an application requirement, they should be removed from the circuit during programming and debugging. alternatively, refer to the ac/dc characteristics and timing requirements information in the respective device flash programming specification for information on capacitive loading limits, and pin voltage input high (v ih ) and voltage input low (v il ) requirements. for device emulation, ensure that the communication channel select pins (i.e., pgecx/pgedx), programmed into the device, match the physical connections for the icsp to the microchip debugger/ emulator tool. for more information on available microchip development tools connection requirements, refer to section 31.0 development support . -80 -70 -60 -50 -40 -30 -20 -10 0 10 5 1011121314151617 dc bias voltage (vdc) capacitance change (%) 01234 6789 16v capacitor 10v capacitor 6.3v capacitor downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 45 pic24fj1024ga610/gb610 family 2.6 external oscillator pins many microcontrollers have options for at least two oscillators: a high-frequency primary oscillator and a low-frequency secondary oscillator (refer to section 9.0 oscillator configuration for details). the oscillator circuit should be placed on the same side of the board as the device. place the oscillator circuit close to the respective oscillator pins with no more than 0.5 inch (12 mm) between the circuit components and the pins. the load capacitors should be placed next to the oscillator itself, on the same side of the board. use a grounded copper pour around the oscillator circuit to isolate it from surrounding circuits. the grounded copper pour should be routed directly to the mcu ground. do not run any signal traces or power traces inside the ground pour. also, if using a two-sided board, avoid any traces on the other side of the board where the crystal is placed. layout suggestions are shown in figure 2-5 . in-line packages may be handled with a single-sided layout that completely encompasses the oscillator pins. with fine-pitch packages, it is not always possible to com- pletely surround the pins and components. a suitable solution is to tie the broken guard sections to a mirrored ground layer. in all cases, the guard trace(s) must be returned to ground. in planning the applications routing and i/o assign- ments, ensure that adjacent port pins, and other signals in close proximity to the oscillator, are benign (i.e., free of high frequencies, short rise and fall times and other similar noise). for additional information and design guidance on oscillator circuits, please refer to these microchip application notes, available at the corporate web site ( www.microchip.com ): an943, practical picmicro ? oscillator analysis and design an949, making your oscillator work an1798, crystal selection for low-power secondary oscillator figure 2-5: suggested placement of the oscillator circuit gnd `` ` osci osco sosco sosc i copper pour primary oscillator crystal secondary crystal device pins primary oscillator c1c2 sec oscillator: c1 sec oscillator: c2 (tied to ground) gnd osco osci bottom layer copper pour oscillator crystal top layer copper pour c2 c1 device pins (tied to ground) (tied to ground) single-sided and in-line layouts: fine-pitch (dual-sided) layouts: oscillator downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 46 ? 2015 microchip technology inc. 2.7 configuration of analog and digital pins during icsp operations if an icsp compliant emulator is selected as a debug- ger, it automatically initializes all of the a/d input pins (anx) as digital pins. depending on the particular device, this is done by setting all bits in the adxpcfg register(s) or clearing all bits in the ansx registers. all pic24f devices will have either one or more adxpcfg registers, or several ansx registers (one for each port); no device will have both. refer to ( section 11.2 configuring analog port pins (ansx) ) for more specific information. the bits in these registers that correspond to the a/d pins that initialized the emulator must not be changed by the user application firmware; otherwise, communication errors will result between the debugger and the device. if your application needs to use certain a/d pins as analog input pins during the debug session, the user application must modify the appropriate bits during initialization of the a/d module, as follows: for devices with an adxpcfg register, clear the bits corresponding to the pin(s) to be configured as analog. do not change any other bits, particu- larly those corresponding to the pgecx/pgedx pair, at any time. for devices with ansx registers, set the bits corresponding to the pin(s) to be configured as analog. do not change any other bits, particularly those corresponding to the pgecx/pgedx pair, at any time. when a microchip debugger/emulator is used as a programmer, the user application firmware must correctly configure the adxpcfg or ansx registers. automatic initialization of these registers is only done during debugger operation. failure to correctly configure the register(s) will result in all a/d pins being recognized as analog input pins, resulting in the port value being read as a logic 0 , which may affect user application functionality. 2.8 unused i/os unused i/o pins should be configured as outputs and driven to a logic low state. alternatively, connect a 1 k ? to 10 k ? resistor to v ss on unused pins and drive the output to logic low. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 47 pic24fj1024ga610/gb610 family 3.0 cpu the pic24f cpu has a 16-bit (data) modified harvard architecture with an enhanced instruction set and a 24-bit instruction word with a variable length opcode field. the program counter (pc) is 23 bits wide and addresses up to 4m instructions of user program memory space. a single-cycle instruction prefetch mechanism is used to help maintain throughput and provides predictable execution. all instructions execute in a single cycle, with the exception of instructions that change the program flow, the double-word move ( mov.d ) instruction and the table instructions. overhead-free program loop constructs are supported using the repeat instructions, which are interruptible at any point. pic24f devices have sixteen, 16-bit working registers in the programmers model. each of the working registers can act as a data, address or address offset register. the 16 th working register (w15) operates as a software stack pointer (ssp) for interrupts and calls. the lower 32 kbytes of the data space (ds) can be accessed linearly. the upper 32 kbytes of the data space are referred to as extended data space (eds), to which the extended data ram, epmp memory space or program memory can be mapped. the instruction set architecture (isa) has been significantly enhanced beyond that of the pic18, but maintains an acceptable level of backward compatibil- ity. all pic18 instructions and addressing modes are supported, either directly, or through simple macros. many of the isa enhancements have been driven by compiler efficiency needs. the core supports inherent (no operand), relative, literal, memory direct addressing modes along with three groups of addressing modes. all modes support register direct and various register indirect modes. each group offers up to seven addressing modes. instructions are associated with predefined addressing modes depending upon their functional requirements. for most instructions, the core is capable of executing a data (or program data) memory read, a working reg- ister (data) read, a data memory write and a program (instruction) memory read per instruction cycle. as a result, three parameter instructions can be supported, allowing trinary operations (that is, a + b = c) to be executed in a single cycle. a high-speed, 17-bit x 17-bit multiplier has been included to significantly enhance the core arithmetic capability and throughput. the multiplier supports signed, unsigned and mixed mode, 16-bit x 16-bit or 8-bit x 8-bit, integer multiplication. all multiply instructions execute in a single cycle. the 16-bit alu has been enhanced with integer divide assist hardware that supports an iterative non-restoring divide algorithm. it operates in conjunction with the repeat instruction looping mechanism and a selection of iterative divide instructions to support 32-bit (or 16-bit), divided by 16-bit, integer signed and unsigned division. all divide operations require 19 cycles to complete but are interruptible at any cycle boundary. the pic24f has a vectored exception scheme with up to 8 sources of non-maskable traps and up to 118 inter- rupt sources. each interrupt source can be assigned to one of seven priority levels. a block diagram of the cpu is shown in figure 3-1 . 3.1 programmers model the programmers model for the pic24f is shown in figure 3-2 . all registers in the programmers model are memory-mapped and can be manipulated directly by instructions. a description of each register is provided in tab le 3 -1 . all registers associated with the programmers model are memory-mapped. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information on the cpu, refer to the dspic33/pic24 family ref- erence manual , cpu with extended data space (eds) (ds39732), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 48 ? 2015 microchip technology inc. figure 3-1: pic24f cp u core block diagram table 3-1: cpu core registers register(s) name description w0 through w15 working register array pc 23-bit program counter sr alu status register splim stack pointer limit value register tblpag table memory page address register rcount repeat loop counter register corcon cpu control register disicnt disable interrupt count register dsrpag data space read page register dswpag data space write page register instruction decode and control pch 16 program counter 16-bit alu 23 23 24 23 data bus instruction reg 16 divide support rom latch 16 ea mux ragu wagu 16 16 8 interrupt controller stack control logic loop control logic data latch data ram address latch control signals to various blocks program memory/ data latch address bus 16 literal data 16 16 hardware multiplier 16 to peripheral modules address latch up to 0x7fff extended data space pcl 16 x 16 w register array eds and table data access control block downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 49 pic24fj1024ga610/gb610 family figure 3-2: programmers model n ov z c tblpag 22 0 7 0 0 15 program counter table memory page alu status register (sr) working/address registers w0 (wreg) w1w2 w3 w4 w5 w6 w7 w8 w9 w10 w11 w12 w13 frame pointer stack pointer ra 0 rcount 15 0 repeat loop counter splim stack pointer limit srl 00 15 0 cpu control register (corcon) srh w14 w15 dc ipl 210 pc divider working registers multiplier registers 15 0 value register address register register data space read page register data space write page register disable interrupt count register 13 0 disicnt 90 dsrpag 80 dswpag ipl3 registers or bits are shadowed for push.s and pop.s instructions. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 50 ? 2015 microchip technology inc. 3.2 cpu control registers register 3-1: sr: alu status register u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 d c bit 15 bit 8 r/w-0 ( 1 ) r/w-0 ( 1 ) r/w-0 ( 1 ) r-0 r/w-0 r/w-0 r/w-0 r/w-0 ipl2 ( 2 ) ipl1 ( 2 ) ipl0 ( 2 ) ra n ov z c bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-9 unimplemented: read as 0 bit 8 dc: alu half carry/borrow bit 1 = a carry out from the 4 th low-order bit (for byte-sized data) or 8 th low-order bit (for word-sized data) of the result occurred 0 = no carry out from the 4 th or 8 th low-order bit of the result has occurred bit 7-5 ipl<2:0>: cpu interrupt priority level status bits ( 1 , 2 ) 111 = cpu interrupt priority level is 7 (15); user interrupts are disabled 110 = cpu interrupt priority level is 6 (14) 101 = cpu interrupt priority level is 5 (13) 100 = cpu interrupt priority level is 4 (12) 011 = cpu interrupt priority level is 3 (11) 010 = cpu interrupt priority level is 2 (10) 001 = cpu interrupt priority level is 1 (9) 000 = cpu interrupt priority level is 0 (8) bit 4 ra: repeat loop active bit 1 = repeat loop in progress 0 = repeat loop not in progress bit 3 n: alu negative bit 1 = result was negative 0 = result was not negative (zero or positive) bit 2 ov: alu overflow bit 1 = overflow occurred for signed (2s complement) arithmetic in this arithmetic operation 0 = no overflow has occurred bit 1 z: alu zero bit 1 = an operation, which affects the z bit, has set it at some time in the past 0 = the most recent operation, which affects the z bit, has cleared it (i.e., a non-zero result) bit 0 c: alu carry/borrow bit 1 = a carry out from the most significant bit (msb) of the result occurred 0 = no carry out from the most significant bit of the result occurred note 1: the iplx status bits are read-only when nstdis (intcon1<15>) = 1 . 2: the iplx status bits are concatenated with the ipl3 status bit (corcon<3>) to form the cpu interrupt priority level (ipl). the value in parentheses indicates the ipl when ipl3 = 1 . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 51 pic24fj1024ga610/gb610 family register 3-2: corcon: cp u core control register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 u-0 r/c-0 r/w-1 u-0 u-0 i p l 3 ( 1 ) psv ( 2 ) bit 7 bit 0 legend: c = clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-4 unimplemented: read as 0 bit 3 ipl3: cpu interrupt priority level status bit ( 1 ) 1 = cpu interrupt priority level is greater than 7 0 = cpu interrupt priority level is 7 or less bit 2 psv: program space visibility (psv) in data space enable 1 = program space is visible in data space 0 = program space is not visible in data space bit 1-0 unimplemented: read as 0 note 1: the ipl3 bit is concatenated with the ipl<2:0> bits (sr<7:5>) to form the cpu interrupt priority level; see register 3-1 for bit description. 2: if psv = 0 , any reads from data memory at 0x8000 and above will cause an address trap error instead of reading from the psv section of program memory. this bit is not individually addressable. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 52 ? 2015 microchip technology inc. 3.3 arithmetic logic unit (alu) the pic24f alu is 16 bits wide and is capable of addi- tion, subtraction, bit shifts and logic operations. unless otherwise mentioned, arithmetic operations are 2s complement in nature. depending on the operation, the alu may affect the values of the carry (c), zero (z), negative (n), overflow (ov) and digit carry (dc) status bits in the sr register. the c and dc status bits operate as borrow and digit borrow bits, respectively, for subtraction operations. the alu can perform 8-bit or 16-bit operations, depending on the mode of the instruction that is used. data for the alu operation can come from the w register array, or data memory, depending on the addressing mode of the instruction. likewise, output data from the alu can be written to the w register array or a data memory location. the pic24f cpu incorporates hardware support for both multiplication and division. this includes a dedicated hardware multiplier and support hardware for 16-bit divisor division. 3.3.1 multiplier the alu contains a high-speed, 17-bit x 17-bit multiplier. it supports unsigned, signed or mixed sign operation in several multiplication modes: 16-bit x 16-bit signed 16-bit x 16-bit unsigned 16-bit signed x 5-bit (literal) unsigned 16-bit unsigned x 16-bit unsigned 16-bit unsigned x 5-bit (literal) unsigned 16-bit unsigned x 16-bit signed 8-bit unsigned x 8-bit unsigned 3.3.2 divider the divide block supports 32-bit/16-bit and 16-bit/16-bit signed and unsigned integer divide operations with the following data sizes: 1. 32-bit signed/16-bit signed divide 2. 32-bit unsigned/16-bit unsigned divide 3. 16-bit signed/16-bit signed divide 4. 16-bit unsigned/16-bit unsigned divide the quotient for all divide instructions ends up in w0 and the remainder in w1. the 16-bit signed and unsigned div instructions can specify any w register for both the 16-bit divisor (wn), and any w register (aligned) pair (w(m + 1):wm) for the 32-bit dividend. the divide algorithm takes one cycle per bit of divisor, so both 32-bit/16-bit and 16-bit/16-bit instructions take the same number of cycles to execute. 3.3.3 multi-bit shift support the pic24f alu supports both single bit and single- cycle, multi-bit arithmetic and logic shifts. multi-bit shifts are implemented using a shifter block, capable of per- forming up to a 15-bit arithmetic right shift, or up to a 15-bit left shift, in a single cycle. all multi-bit shift instructions only support register direct addressing for both the operand source and result destination. a full summary of instructions that use the shift operation is provided in table 3-2 . table 3-2: instructions that use the si ngle bit and multi-bit shift operation instruction description asr arithmetic shift right source register by one or more bits. sl shift left source register by one or more bits. lsr logical shift right source register by one or more bits. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 53 pic24fj1024ga610/gb610 family 4.0 memory organization as harvard architecture devices, pic24f micro- controllers feature separate program and data memory spaces and buses. this architecture also allows direct access of program memory from the data space during code execution. 4.1 program memory space the program address memory space of the pic24fj1024ga610/gb610 family devices is 4m instructions. the space is addressable by a 24-bit value derived from either the 23-bit program counter (pc) during program execution, or from table operation or data space remapping, as described in section 4.3 interfacing program and data memory spaces . user access to the program memory space is restricted to the lower half of the address range (000000h to 7fffffh). the exception is the use of tblrd/tblwt operations, which use tblpag<7> to permit access to the configuration bits and customer otp sections of the configuration memory space. the pic24fj1024ga610/gb610 family of devices supports a single partition mode and two dual partition modes. the dual partition modes allow the device to be programmed with two separate applications to facil- itate bootloading or to allow an application to be programmed at run time without stalling the cpu. memory maps for the pic24fj1024ga610/gb610 family of devices are shown in figure 4-1 . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 54 ? 2015 microchip technology inc. figure 4-1: program space memory map for pic24fj1024ga610/gb610 family devices table 4-1: program memory sizes and boundaries ( 1 ) device program memory upper boundary (instruction words) write blocks ( 2 ) erase blocks ( 2 ) single partition mode dual partition mode active partition inactive partition pic24fj1024gx6xx 0abffeh (352k) 055ffeh (176k) 455ffeh (176k) 5504 688 pic24fj512gx6xx 055ffeh (176k) 02affeh (88k) 42affeh (88k) 2752 344 pic24fj256gx6xx 02affeh (88k) 0157feh (44k) 4157feh (44k) 1376 172 pic24fj128gx6xx 015ffeh (44k) 00affeh (22k) 40affeh (22k) 688 86 note 1: includes flash configuration words. 2: 1 write block = 128 instruction words; 1 erase block = 1024 instruction words. 000000h fa00feh fa0100h fefffeh ffffffh configuration memory space user memory space flash write latches devid (2) reserved ff0000h f9fffeh fa0000h 800000h 7fffffh reserved flash config words 0xxx00h (1) 0xxxfeh (1) unimplemented read 0 user flash program memory fboot 801802h 801800h reserved ff0004h reserved executive code memory 800ffeh 800100h customer otp memory 8017feh 801700h reserved 801000h 801804h 8016feh single partition mode 000000h configuration memory space user memory space 800000h 7fffffh reserved flash config words 0xxx00h (1) 0xxxfeh (1) unimplemented read 0 user flash program memory fboot 801802h 801800h reserved executive code memory 800ffeh 800100h customer otp memory 8017feh 801700h reserved 801000h 801804h 8016feh 400000h flash config words user flash program memory 4xxx00h (1) 4xxxfeh (1) unimplemented read 0 fa00feh fa0100h fefffeh ffffffh flash write latches devid(2) reserved ff0000h f9fffeh fa0000h ff0004h reserved legend: memory areas are not shown to scale. note 1: exact boundary addresses are determined by the size of the implemented program memory ( table 4-1 ). dual partition mode downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 55 pic24fj1024ga610/gb610 family 4.1.1 program memory organization the program memory space is organized in word- addressable blocks. although it is treated as 24 bits wide, it is more appropriate to think of each address of the program memory as a lower and upper word, with the upper byte of the upper word being unimplemented. the lower word always has an even address, while the upper word has an odd address ( figure 4-3 ). program memory addresses are always word-aligned on the lower word and addresses are incremented or decremented by two during code execution. this arrangement also provides compatibility with data memory space addressing and makes it possible to access data in the program memory space. in single partition mode, user program memory is arranged in a contiguous block starting at address, 000000h. 4.1.2 dual partition flash program memory organization in the dual partition modes, the devices memory is divided evenly into two physical sections, known as partition 1 and partition 2. each of these partitions con- tains its own program memory and configuration words. during program execution, the code on only one of these panels is executed; this is the active par- tition. the other partition, or the inactive partition, is not used, but can be programmed. the active partition is always mapped to logical address, 000000h, while the inactive partition will always be mapped to logical address, 400000h. note that even when the code partitions are switched between active and inactive by the user, the address of the active partition will still be at 000000h and the address of the inactive partition will still be at 400000h. the boot sequence configuration word (fbtseq) determines whether partition 1 or partition 2 will be active after reset. if the part is operating in dual partition mode, the partition with the lower boot sequence number will operate as the active partition (fbtseq is unused in single partition mode). the partitions can be switched between active and inactive by reprogramming their boot sequence numbers, but the active partition will not change until a device reset is performed. if both boot sequence numbers are the same, or if both are corrupted, the part will use partition 1 as the active parti- tion. if only one boot sequence number is corrupted, the device will use the partition without a corrupted boot sequence number as the active partition. the user can also change which partition is active at run time using the bootswp instruction. issuing a bootswp instruction does not affect which partition will be the active partition after a reset. figure 4-2 demonstrates how the relationship between partitions 1 and 2, shown in red and blue respectively, and the active and inactive partitions are affected by reprogramming the boot sequence number or issuing a bootswp instruction. the p2activ bit (nvmcon<10>) can be used to deter- mine which physical partition is the active partition. if p2activ = 1 , partition 2 is active; if p2activ = 0 , partition 1 is active. 4.1.3 hard memory vectors all pic24f devices reserve the addresses between 000000h and 000200h for hard-coded program execu- tion vectors. a hardware reset vector is provided to redirect code execution from the default value of the pc on a device reset to the actual start of code. a goto instruction is programmed by the user at 000000h, with the actual address for the start of code at 000002h. the pic24fj1024ga610/gb610 devices can have up to two interrupt vector tables (ivt). the first is located from addresses, 000004h to 0000ffh. the alternate interrupt vector table (aivt), which can be enabled by the aivtdis configuration bit, is located from 000104h to 0001ffh if no boot segment (bs) is present. if the user has configured a boot segment, the aivt will be located at the address, (bslim<12:0> x 1024) C 508. these vector tables allow each of the many device interrupt sources to be handled by separate isrs. a more detailed discussion of the interrupt vector tables is provided in section 8.1 interrupt vector table . 4.1.4 configuration bits overview the configuration bits are stored in the last page loca- tion of implemented program memory. these bits can be set or cleared to select various device configurations. there are two types of configuration bits: system oper- ation bits and code-protect bits. the system operation bits determine the power-on settings for system-level components, such as the oscillator and the watchdog timer. the code-protect bits prevent program memory from being read and written. table 4-2 lists the configuration register address range for each device in single and dual partition modes. table 4-2 lists all of the configuration bits found in the pic24fj1024ga610/gb610 family devices, as well as their configuration register locations. refer to section 30.0 special features in this data sheet for the full configuration register description for each specific device. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 56 ? 2015 microchip technology inc. figure 4-2: relationship between part itions 1/2 and active/inactive partitions active partition active partition inactive partition inactive partition partition 1 bseq = 10 partition 2 bseq = 15 partition 2 bseq = 15 partition 1 bseq = 10 partition 1 bseq = 10 partition 2 bseq = 15 partition 1 bseq = 10 partition 2 bseq = 15 partition 1 bseq = 10 partition 2 bseq = 5 partition 2 bseq = 5 partition 1 bseq = 10 000000h400000h 000000h400000h 000000h 400000h 000000h400000h 000000h400000h 000000h 400000h reset bootswp instruction reprogram bseq reset downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 57 pic24fj1024ga610/gb610 family table 4-2: config uration word addresses configuration register single partition mode pic24fj1024gx6xx pic24fj512gx6xx pic24fj256gx6xx pic24fj128gx6xx fsec 0abf00h 055f00h 02af00h 015f00h fbslim 0abf10h 055f10h 02af10h 015f10h fsign 0abf14h 055f14h 02af14h 015f14h foscsel 0abf18h 055f18h 02af18h 015f18h fosc 0abf1ch 055f1ch 02af1ch 015f1ch fwdt 0abf20h 055f20h 02af20h 015f20h fpor 0abf24h 055f24h 02af24h 015f24h ficd 0abf28h 055f28h 02af28h 015f28h fdevopt1 0abf2ch 055f2ch 02af2ch 015f2ch fboot 801800h dual partition modes ( 1 ) fsec ( 2 ) 055f00h/455f00h 02af00h/42af00h 015700h/415700h 00af00h/40af00h fbslim ( 2 ) 055f10h/455f10h 02af10h/42af10h 015710h/415710h 00af10h/40af10h fsign ( 2 ) 055f14h/455f14h 02af14h/42af14h 015714h/415714h 00af14h/40af14h foscsel 055f18h/455f18h 02af18h/42af18h 015718h/415718h 00af18h/40af18h fosc 055f1ch/455f1ch 02af1ch/42af1ch 01571ch/41571ch 00af1ch/40af1ch fwdt 055f20h/455f20h 02af20h/42af20h 015720h/415720h 00af20h/40af20h fpor 055f24h/455f24h 02af24h/42af24h 015724h/415724h 00af24h/40af24h ficd 055f28h/455f28h 02af28h/42af28h 015728h/415728h 00af28h/40af28h fdevopt1 055f2ch/455f2ch 02af2ch/42af2ch 01572ch/41572ch 00af2ch/40af2ch fbtseq ( 3 ) 055ffch/455ffch 02affch/42affch 0157fch/4157fch 00affch/40affch fboot 801800h note 1: addresses shown for dual partition modes are for the active/inactive partitions, respectively. 2: changes to these inactive partition configuration words affect how the active partition accesses the inactive partition. 3: fbtseq is a 24-bit configuration word, using all three bytes of the program memory width. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 58 ? 2015 microchip technology inc. 4.1.5 code-protect configuration bits the device implements intermediate security features defined by the fsec register. the boot segment (bs) is the higher privilege segment and the general seg- ment (gs) is the lower privilege segment. the total user code memory can be split into bs or gs. the size of the segments is determined by the bslim<12:0> bits. the relative location of the segments within user space does not change, such that bs (if present) occu- pies the memory area just after the interrupt vector table (ivt) and the gs occupies the space just after the bs (or if the alternate ivt is enabled, just after it). the configuration segment (cs) is a small segment (less than a page, typically just one row) within user flash address space. it contains all user configuration data that is loaded by the nvm controller during the reset sequence. 4.1.6 customer otp memory pic24fj1024ga610/gb610 family devices provide 256 bytes of one-time-programmable (otp) mem- ory, located at addresses, 801700h through 8017feh. this memory can be used for persistent storage of application-specific information that will not be erased by reprogramming the device. this includes many types of information, such as (but not limited to): application checksums code revision information product information serial numbers system manufacturing dates manufacturing lot numbers customer otp memory may be programmed in any mode, including user rtsp mode, but it cannot be erased. data is not cleared by a chip erase. do not write the otp memory more than one time. writing to the otp memory more than once may result in a permanent ecc double-bit error (eccdbe) trap. therefore, writing to otp memory should only be done after the firmware is debugged and the part is programmed in a production environment. 4.1.7 dual partition configuration words in dual partition modes, each partition has its own set of flash configuration words. the full set of configuration registers in the active partition is used to determine the devices configuration; the configuration words in the inactive partition are used to determine the devices configuration when that partition becomes active. how- ever, some of the configuration registers in the inactive partition (fsec, fbslim and fsign) may be used to determine how the active partition is able or allowed to access the inactive partition. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 59 pic24fj1024ga610/gb610 family 4.2 data memory space the pic24f core has a 16-bit wide data memory space, addressable as a single linear range. the data space is accessed using two address generation units (agus), one each for read and write operations. the data space memory map is shown in figure 4-3 . the 16-bit wide data addresses in the data memory space point to bytes within the data space (ds). this gives a ds address range of 32 kbytes or 16k words. the lower half (0000h to 7fffh) is used for implemented (on-chip) memory addresses. the upper half of data memory address space (8000h to ffffh) is used as a window into the extended data space (eds). this allows the microcontroller to directly access a greater range of data beyond the standard 16-bit address range. eds is discussed in detail in section 4.2.5 extended data space (eds) . the lower half of ds is compatible with previous pic24f microcontrollers without eds. all pic24fj1024ga610/ gb610 family devices implement 30 kbytes of data ram in the lower half of ds, from 0800h to 7fff. 4.2.1 data space width the data memory space is organized in byte- addressable, 16-bit wide blocks. data is aligned in data memory and registers as 16-bit words, but all data space eas resolve to bytes. the least significant bytes (lsbs) of each word have even addresses, while the most significant bytes (msbs) have odd addresses. figure 4-3: data space memory map for pic24fj1024ga610/gb610 family devices note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive refer- ence source. for more information, refer to the dspic33 / pic24 family reference manual , data memory with extended data space (eds) (ds39733). the infor- mation in this data sheet supersedes the information in the frm. note: memory areas not shown to scale. 0000h 07feh fffeh lsb address lsb msb msb address 0001h 07ffh 1fffh ffffh 8001h 8000h 7fffh 0801h 0800h 2001h near 1ffeh sfr 2000h 7ffeh eds window space data space upper 32 kbytes data space lower 32 kbytes data space 30 kbytes data ram sfr space eds page 0x1 (2 kbytes implemented) eds page 0x2 eds page 0x1ff eds page 0x200 eds page 0x2ff eds page 0x300 eds page 0x3ff internal extended data ram (2 kbytes) epmp memory space program space visibility area to access lower word of program memory program space visibility area to access upper word of program memory downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 60 ? 2015 microchip technology inc. 4.2.2 data memory organization and alignment to maintain backward compatibility with pic ? mcus and improve data space memory usage efficiency, the pic24f instruction set supports both word and byte operations. as a consequence of byte accessibility, all ea calculations are internally scaled to step through word-aligned memory. for example, the core recognizes that post-modified register indirect addressing mode, [ws++], will result in a value of ws + 1 for byte operations and ws + 2 for word operations. data byte reads will read the complete word, which contains the byte, using the lsb of any ea to deter- mine which byte to select. the selected byte is placed onto the lsb of the data path. that is, data memory and registers are organized as two parallel, byte-wide entities with shared (word) address decode, but separate write lines. data byte writes only write to the corresponding side of the array or register which matches the byte address. all word accesses must be aligned to an even address. misaligned word data fetches are not supported, so care must be taken when mixing byte and word operations or translating from 8-bit mcu code. if a misaligned read or write is attempted, an address error trap will be generated. if the error occurred on a read, the instruction underway is completed; if it occurred on a write, the instruction will be executed but the write will not occur. in either case, a trap is then executed, allow- ing the system and/or user to examine the machine state prior to execution of the address fault. all byte loads into any w register are loaded into the lsb. the most significant byte (msb) is not modified. a sign-extend ( se ) instruction is provided to allow users to translate 8-bit signed data to 16-bit signed values. alternatively, for 16-bit unsigned data, users can clear the msb of any w register by executing a zero-extend ( ze ) instruction on the appropriate address. although most instructions are capable of operating on word or byte data sizes, it should be noted that some instructions operate only on words. 4.2.3 near data space the 8-kbyte area between 0000h and 1fffh is referred to as the near data space. locations in this space are directly addressable via a 13-bit absolute address field within all memory direct instructions. the remainder of the data space is addressable indirectly. additionally, the whole data space is addressable using mov instructions, which support memory direct addressing with a 16-bit address field. 4.2.4 special function register (sfr) space the first 2 kbytes of the near data space, from 0000h to 07ffh, are primarily occupied with special function registers (sfrs). these are used by the pic24f core and peripheral modules for controlling the operation of the device. sfrs are distributed among the modules that they con- trol and are generally grouped together by module. much of the sfr space contains unused addresses; these are read as 0 . a diagram of the sfr space, showing where the sfrs are actually implemented, is shown in tab le 4 - 3 . each implemented area indicates a 32-byte region where at least one address is implemented as an sfr. a complete list of imple- mented sfrs, including their addresses, is shown in tables 4-3 through 4-11 . table 4-3: implemented regions of sfr data space sfr space address xx00 xx10 xx20 xx30 xx40 xx50 xx60 xx70 xx80 xx90 xxa0 xxb0 xxc0 xxd0 xxe0 xxf0 000h core 100h osc reset ( 1 ) epmp crc refo pmd timers ctm rtcc 200h capture compare mccp comp ancfg 300h sccp uart spi 400h spi c l c i 2 cd m a 500h dma u s b 600h i / o 700h a / d p p s legend: = no implemented sfrs in this block note 1: includes hlvd control. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 61 pic24fj1024ga610/gb610 family table 4-4: sfr map: 0000h block file name address all resets file name address all resets cpu core interrupt controller (continued) wreg0 0000 0000 iec1 009a 0000 wreg1 0002 0000 iec2 009c 0000 wreg2 0004 0000 iec3 009e 0000 wreg3 0006 0000 iec4 00a0 0000 wreg4 0008 0000 iec5 00a2 0000 wreg5 000a 0000 iec6 00a4 0000 wreg6 000c 0000 iec7 00a6 0000 wreg7 000e 0000 ipc0 00a8 4444 wreg8 0010 0000 ipc1 00aa 4444 wreg9 0012 0000 ipc2 00ac 4444 wreg10 0014 0000 ipc3 00ae 4444 wreg11 0016 0000 ipc4 00b0 4444 wreg12 0018 0000 ipc5 00b2 4404 wreg13 001a 0000 ipc6 00b4 4444 wreg14 001c 0000 ipc7 00b6 4444 wreg15 001e 0800 ipc8 00b8 0044 splim 0020 xxxx ipc9 00ba 4444 pcl 002e 0000 ipc10 00bc 4444 pch 0030 0000 ipc11 00be 4444 dsrpag 0032 0000 ipc12 00c0 4444 dswpag 0034 0000 ipc13 00c2 0440 rcount 0036 xxxx ipc14 00c4 4400 sr 0042 0000 ipc15 00c6 4444 corcon 0044 0004 ipc16 00c8 4444 disicnt 0052 xxxx ipc17 00ca 4444 tblpag 0054 0000 ipc18 00cc 0044 interrupt controller ipc19 00ce 0040 intcon1 0080 0000 ipc20 00d0 4440 intcon2 0082 8000 ipc21 00d2 4444 intcon4 0086 0000 ipc22 00d4 4444 ifs0 0088 0000 ipc23 00d6 4400 ifs1 008a 0000 ipc24 00d8 4444 ifs2 008c 0000 ipc25 00da 0440 ifs3 008e 0000 ipc26 00dc 0400 ifs4 0090 0000 ipc27 00de 4440 ifs5 0092 0000 ipc28 00e0 4444 ifs6 0094 0000 ipc29 00e2 0044 ifs7 0096 0000 inttreg 00e4 0000 iec0 0098 0000 legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 62 ? 2015 microchip technology inc. table 4-5: sfr map: 0100h block file name address all resets file name address all resets oscillator pmd (continued) osccon 0100 xxx0 pmd5 0180 0000 clkdiv 0102 30x0 pmd6 0182 0000 osctun 0106 xxxx pmd7 0184 0000 dcotun 0108 0000 pmd8 0186 0000 dcocon 010a 0x00 timer oscdiv 010c 0001 tmr1 0190 0000 oscfdiv 010e 0000 pr1 0192 ffff reset t1con 0194 0000 rcon 0110 0003 tmr2 0196 0000 hlvd tmr3hld 0198 0000 hlvdcon 0114 0600 tmr3 019a 0000 pmp pr2 019c ffff pmcon1 0128 0000 pr3 019e ffff pmcon2 012a 0000 t2con 01a0 0x00 pmcon3 012c 0000 t3con 01a2 0x00 pmcon4 012e 0000 tmr4 01a4 0000 pmcs1cf 0130 0000 tmr5hld 01a6 0000 pmcs1bs 0132 0000 tmr5 01a8 0000 pmcs1md 0134 0000 pr4 01aa ffff pmcs2cf 0136 0000 pr5 01ac ffff pmcs2bs 0138 0000 t4con 01ae 0x00 pmcs2md 013a 0000 t5con 01b0 0x00 pmdout1 013c xxxx ctmu pmdout2 013e xxxx ctmucon1l 01c0 0000 pmdin1 0140 xxxx ctmucon1h 01c2 0000 pmdin2 0142 xxxx ctmucon2l 01c4 0000 pmstat 0144 008f real-time clock and calendar (rtcc) crc rtccon1l 01cc xxxx crccon1 0158 00x0 rtccon1h 01ce xxxx crccon2 015a 0000 rtccon2l 01d0 xxxx crcxorl 015c 0000 rtccon2h 01d2 xxxx crcxorh 015e 0000 rtccon3l 01d4 xxxx crcdatl 0160 xxxx rtcstatl 01d8 00xx crcdath 0162 xxxx timel 01dc xx00 crcwdatl 0164 xxxx timeh 01de xxxx crcwdath 0166 xxxx datel 01e0 xx0x refo dateh 01e2 xxxx refoconl 0168 0000 almtimel 01e4 xx00 refoconh 016a 0000 almtimeh 01e6 xxxx refotriml 016c 0000 almdatel 01e8 xx0x pmd almdateh 01ea xxxx pmd1 0178 0000 tsatimel 01ec xx00 pmd2 017a 0000 tsatimeh 01ee xxxx pmd3 017c 0000 tsadatel 01f0 xx0x pmd4 017e 0000 tsadateh 01f2 xxxx legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 63 pic24fj1024ga610/gb610 family table 4-6: sfr map: 0200h block file name address all resets file name address all resets input capture output capture (continued) ic1con1 0200 0000 oc4r 0254 xxxx ic1con2 0202 000d oc4tmr 0256 xxxx ic1buf 0204 0000 oc5con1 0258 0000 ic1tmr 0206 0000 oc5con2 025a 000c ic2con1 0208 0000 oc5rs 025c xxxx ic2con2 020a 000d oc5r 025e xxxx ic2buf 020c 0000 oc5tmr 0260 xxxx ic2tmr 020e 0000 oc6con1 0262 0000 ic3con1 0210 0000 oc6con2 0264 000c ic3con2 0212 000d oc6rs 0266 xxxx ic3buf 0214 0000 oc6r 0268 xxxx ic3tmr 0216 0000 oc6tmr 026a xxxx ic4con1 0218 0000 multiple output capture/compare/pwm ic4con2 021a 000d ccp1con1l 026c 0000 ic4buf 021c 0000 ccp1con1h 026e 0000 ic4tmr 021e 0000 ccp1con2l 0270 0000 ic5con1 0220 0000 ccp1con2h 0272 0100 ic5con2 0222 000d ccp1con3l 0274 0000 ic5buf 0224 0000 ccp1con3h 0276 0000 ic5tmr 0226 0000 ccp1statl 0278 00x0 ic6con1 0228 0000 ccp1stath 027a 0000 ic6con2 022a 000d ccp1tmrl 027c 0000 ic6buf 022c 0000 ccp1tmrh 027e 0000 ic6tmr 022e 0000 ccp1prl 0280 ffff output compare ccp1prh 0282 ffff oc1con1 0230 0000 ccp1ral 0284 0000 oc1con2 0232 000c ccp1rah 0286 0000 oc1rs 0234 xxxx ccp1rbl 0288 0000 oc1r 0236 xxxx ccp1rbh 028a 0000 oc1tmr 0238 xxxx ccp1bufl 028c 0000 oc2con1 023a 0000 ccp1bufh 028e 0000 oc2con2 023c 000c ccp2con1l 0290 0000 oc2rs 023e xxxx ccp2con1h 0292 0000 oc2r 0240 xxxx ccp2con2l 0294 0000 oc2tmr 0242 xxxx ccp2con2h 0296 0100 oc3con1 0244 0000 ccp2con3l 0298 0000 oc3con2 0246 000c ccp2con3h 029a 0000 oc3rs 0248 xxxx ccp2statl 029c 00x0 oc3r 024a xxxx ccp2stath 029e 0000 oc3tmr 024c xxxx ccp2tmrl 02a0 0000 oc4con1 024e 0000 ccp2tmrh 02a2 0000 oc4con2 0250 000c ccp2prl 02a4 ffff oc4rs 0252 xxxx ccp2prh 02a6 ffff legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 64 ? 2015 microchip technology inc. multiple output capture/compare/pwm (continued) multiple output capture/compare/pwm (continued) ccp2ral 02a8 0000 ccp3prl 02c8 ffff ccp2rah 02aa 0000 ccp3prh 02ca ffff ccp2rbl 02ac 0000 ccp3ral 02cc 0000 ccp2rbh 02ae 0000 ccp3rah 02ce 0000 ccp2bufl 02b0 0000 ccp3rbl 02d0 0000 ccp2bufh 02b2 0000 ccp3rbh 02d2 0000 ccp3con1l 02b4 0000 ccp3bufl 02d4 0000 ccp3con1h 02b6 0000 ccp3bufh 02d6 0000 ccp3con2l 02b8 0000 comparators ccp3con2h 02ba 0100 cmstat 02e6 0000 ccp3con3l 02bc 0000 cvrcon 02e8 00xx ccp3con3h 02be 0000 cm1con 02ea 0000 ccp3statl 02c0 00x0 cm2con 02ec 0000 ccp3stath 02c2 0000 cm3con 02ee 0000 ccp3tmrl o2c4 0000 analog configuration ccp3tmrh 02c6 0000 ancfg 02f4 0000 table 4-6: sfr map: 0200h block (continued) file name address all resets file name address all resets legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 65 pic24fj1024ga610/gb610 family table 4-7: sfr map: 0300h block file name address all resets file name address all resets single output capture/compare/pwm single output capture/compare/pwm (continued ) ccp4con1l 0300 0000 ccp6stath 0356 0000 ccp4con1h 0302 0000 ccp6tmrl 0358 0000 ccp4con2l 0304 0000 ccp6tmrh 035a 0000 ccp4con2h 0306 0100 ccp6prl 035c ffff ccp4con3l 0308 0000 ccp6prh 035e ffff ccp4con3h 030a 0000 ccp6ral 0360 0000 ccp4statl 030c 00x0 ccp6rah 0362 0000 ccp4stath 030e 0000 ccp6rbl 0364 0000 ccp4tmrl 0310 0000 ccp6rbh 0366 0000 ccp4tmrh 0312 0000 ccp6bufl 0368 0000 ccp4prl 0314 ffff ccp6bufh 036a 0000 ccp4prh 0316 ffff ccp7con1l 036c 0000 ccp4ral 0318 0000 ccp7con1h 036e 0000 ccp4rah 031a 0000 ccp7con2l 0370 0000 ccp4rbl 031c 0000 ccp7con2h 0372 0100 ccp4rbh 031e 0000 ccp7con3l 0374 0000 ccp4bufl 0320 0000 ccp7con3h 0376 0000 ccp4bufh 0322 0000 ccp7statl 0378 00x0 ccp5con1l 0324 0000 ccp7stath 037a 0000 ccp5con1h 0326 0000 ccp7tmrl 037c 0000 ccp5con2l 0328 0000 ccp7tmrh 037e 0000 ccp5con2h 032a 0100 ccp7prl 0380 ffff ccp5con3l 032c 0000 ccp7prh 0382 ffff ccp5con3h 032e 0000 ccp7ral 0384 0000 ccp5statl 0330 00x0 ccp7rah 0386 0000 ccp5stath 0332 0000 ccp7rbl 0388 0000 ccp5tmrl 0334 0000 ccp7rbh 038a 0000 ccp5tmrh 0336 0000 ccp7bufl 038c 0000 ccp5prl 0338 ffff ccp7bufh 038e 0000 ccp5prh 033a ffff uart ccp5ral 033c 0000 u1mode 0398 0000 ccp5rah 033e 0000 u1sta 039a 0110 ccp5rbl 0340 0000 u1txreg 039c x0xx ccp5rbh 0342 0000 u1rxreg 039e 0000 ccp5bufl 0344 0000 u1brg 03a0 0000 ccp5bufh 0346 0000 u1admd 03a2 0000 ccp6con1l 0348 0000 u2mode 03ae 0000 ccp6con1h 034a 0000 u2sta 03b0 0110 ccp6con2l 034c 0000 u2txreg 03b2 xxxx ccp6con2h 034e 0100 u2rxreg 03b4 0000 ccp6con3l 0350 0000 u2brg 03b6 0000 ccp6con3h 0352 0000 u2admd 03b8 0000 ccp6statl 0354 00x0 u3mode 03c4 0000 legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 66 ? 2015 microchip technology inc. uart (continued) uart (continued) u3sta 03c6 0110 u5brg 03e4 0000 u3txreg 03c8 xxxx u5admd 03e6 0000 u3rxreg 03ca 0000 u6mode 03e8 0000 u3brg 03cc 0000 u6sta 03ea 0110 u3admd 03ce 0000 u6txreg 03ec xxxx u4mode 03d0 0000 u6rxreg 03ee 0000 u4sta 03d2 0110 u6brg 03f0 0000 u4txreg 03d4 xxxx u6admd 03f2 0000 u4rxreg 03d6 0000 spi u4brg 03d8 0000 spi1con1 03f4 0x00 u4admd 03da 0000 spi1con2 03f6 0000 u5mode 03dc 0000 spi1con3 03f8 0000 u5sta 03de 0110 spi1statl 03fc 0028 u5txreg 03e0 xxxx spi1stath 03fe 0000 u5rxreg 03e2 0000 table 4-7: sfr map: 0300h block (continued) file name address all resets file name address all resets legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 67 pic24fj1024ga610/gb610 family table 4-8: sfr map: 0400h block file name address all resets file name address all resets spi (continued) configurable logic cell (clc) (continued) spi1bufl 0400 0000 clc3conl 047c 0000 spi1bufh 0402 0000 clc3conh 047e 0000 spi1brgl 0404 xxxx clc3sell 0480 0000 spi1imsk1 0408 0000 clc3glsl 0484 0000 spi1imsk2 040a 0000 clc3glsh 0486 0000 spi1urdtl 040c 0000 clc4conl 0488 0000 spi1urdth 040e 0000 clc4conh 048a 0000 spi2con1 0410 0x00 clc4sell 048c 0000 spi2con2 0412 0000 clc4glsl 0490 0000 spi2con3 0414 0000 clc4glsh 0492 0000 spi2statl 0418 0028 i 2 c spi2stath 041a 0000 i2c1rcv 0494 0000 spi2bufl 041c 0000 i2c1trn 0496 00ff spi2bufh 041e 0000 i2c1brg 0498 0000 spi2brgl 0420 xxxx i2c1con1 049a 1000 spi2imsk1 0424 0000 i2c1con2 049c 0000 spi2imsk2 0426 0000 i2c1stat 049e 0000 spi2urdtl 0428 0000 i2c1add 04a0 0000 spi2urdth 042a 0000 i2c1msk 04a2 0000 spi3con1 042c 0x00 i2c2rcv 04a4 0000 spi3con2 042e 0000 i2c2trn 04a6 00ff spi3con3 0430 0000 i2c2brg 04a8 0000 spi3statl 0434 0028 i2c2con1 04aa 1000 spi3stath 0436 0000 i2c2con2 04ac 0000 spi3bufl 0438 0000 i2c2stat 04ae 0000 spi3bufh 043a 0000 i2c2add 04b0 0000 spi3brgl 043c xxxx i2c2msk 04b2 0000 spi3imsk1 0440 0000 i2c3rcv 04b4 0000 spi3imsk2 0442 0000 i2c3trn 04b6 00ff spi3urdtl 0444 0000 i2c3brg 04b8 0000 spi3urdth 0446 0000 i2c3con1 04ba 1000 configurable logic cell (clc) i2c3con2 04bc 0000 clc1conl 0464 0000 i2c3stat 04be 0000 clc1conh 0466 0000 i2c3add 04c0 0000 clc1sell 0468 0000 i2c3msk 04c2 0000 clc1glsl 046c 0000 dma clc1glsh 046e 0000 dmacon 04c4 0000 clc2conl 0470 0000 dmabuf 04c6 0000 clc2conh 0472 0000 dmal 04c8 0000 clc2sell 0474 0000 dmah 04ca 0000 clc2glsl 0478 0000 dmach0 04cc 0000 clc2glsh 047a 0000 dmaint0 04ce 0000 legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 68 ? 2015 microchip technology inc. dma (continued) dma (continued) dmasrc0 04d0 0000 dmacnt2 04e8 0001 dmadst0 04d2 0000 dmach3 04ea 0000 dmacnt0 04d4 0001 dmaint3 04ec 0000 dmach1 04d6 0000 dmasrc3 04ee 0000 dmaint1 04d8 0000 dmadst3 04f0 0000 dmasrc1 04da 0000 dmacnt3 04f2 0001 dmadst1 04dc 0000 dmach4 04f4 0000 dmacnt1 04de 0001 dmaint4 04f6 0000 dmach2 04e0 0000 dmasrc4 04f8 0000 dmaint2 04e2 0000 dmadst4 04fa 0000 dmasrc2 04e4 0000 dmacnt4 04fc 0001 dmadst2 04e6 0000 dmach5 04fe 0000 table 4-8: sfr map: 0400h block (continued) file name address all resets file name address all resets legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 69 pic24fj1024ga610/gb610 family table 4-9: sfr map: 0500h block file name address all resets file name address all resets dma (continued) usb otg (continued) dmaint5 0500 0000 u1addr 056e 00xx dmasrc5 0502 0000 u1bdtp1 0570 0000 dmadst5 0504 0000 u1frml 0572 0000 dmacnt5 0506 0001 u1frmh 0574 0000 dmach6 0508 0000 u1tok 0576 0000 dmaint6 050a 0000 u1sof 0578 0000 dmasrc6 050c 0000 u1bdtp2 057a 0000 dmadst6 050e 0000 u1bdtp3 057c 0000 dmacnt6 0510 0001 u1cnfg1 057e 0000 dmach7 0512 0000 u1cnfg2 0580 0000 dmaint7 0514 0000 u1ep0 0582 0000 dmasrc7 0516 0000 u1ep1 0584 0000 dmadst7 0518 0000 u1ep2 0586 0000 dmacnt7 051a 0001 u1ep3 0588 0000 usb otg u1ep4 058a 0000 u1otgir 0558 0000 u1ep5 058c 0000 u1otgie 055a 0000 u1ep6 058e 0000 u1otgstat 055c 0000 u1ep7 0590 0000 u1otgcon 055e 0000 u1ep8 0592 0000 u1pwrc 0560 00x0 u1ep9 0594 0000 u1ir 0562 0000 u1ep10 0596 0000 u1ie 0564 0000 u1ep11 0598 0000 u1eir 0566 0000 u1ep12 059a 0000 u1eie 0568 0000 u1ep13 059c 0000 u1stat 056a 0000 u1ep14 059e 0000 u1con 056c 00x0 u1ep15 05a0 0000 legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 70 ? 2015 microchip technology inc. table 4-10: sfr map: 0600h block file name address all resets file name address all resets i/o portd (continued) padcon 065e 0000 ansd 06a6 ffff iocstat 0660 0000 iocpd 06a8 0000 porta ( 1 ) iocnd 06aa 0000 trisa 0662 ffff iocfd 06ac 0000 porta 0664 0000 iocpud 06ae 0000 lata 0666 0000 iocpdd 06b0 0000 odca 0668 0000 porte ansa 066a ffff trise 06b2 ffff iocpa 066c 0000 porte 06b4 0000 iocna 066e 0000 late 06b6 0000 iocfa 0670 0000 odce 06b8 0000 iocpua 0672 0000 anse 06ba ffff iocpda 0674 0000 iocpe 06bc 0000 portb iocne 06be 0000 trisb 0676 ffff iocfe 06c0 0000 portb 0678 0000 iocpue 06c2 0000 latb 067a 0000 iocpde 06c4 0000 odcb 067c 0000 portf ansb 067e ffff trisf 06c6 ffff iocpb 0680 0000 portf 06c8 0000 iocnb 0682 0000 latf 06ca 0000 iocfb 0684 0000 odcf 06cc 0000 iocpub 0686 0000 iocpf 06d0 0000 iocpdb 0688 0000 iocnf 06d2 0000 portc iocff 06d4 0000 trisc 068a ffff iocpuf 06d6 0000 portc 068c 0000 iocpdf 06d8 0000 latc 068e 0000 portg odcc 0690 0000 trisg 06da ffff ansc 0692 ffff portg 06dc 0000 iocpc 0694 0000 latg 06de 0000 iocnc 0696 0000 odcg 06e0 0000 iocfc 0698 0000 ansg 06e2 ffff iocpuc 069a 0000 iocpg 06e4 0000 iocpdc 069c 0000 iocng 06e6 0000 portd iocfg 06e8 0000 trisd 069e ffff iocpug 06ea 0000 portd 06a0 0000 iocpdg 06ec 0000 latd 06a2 0000 odcd 06a4 0000 legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. note 1: porta and all associated bits are unimplemented in 64-pin devices and read as 0 . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 71 pic24fj1024ga610/gb610 family table 4-11: sfr map: 0700h block file name address all resets file name address all resets a/d peripheral pin select adc1buf0 0712 xxxx rpinr0 0790 3f3f adc1buf1 0714 xxxx rpinr1 0792 3f3f adc1buf2 0716 xxxx rpinr2 0794 3f3f adc1buf3 0718 xxxx rpinr3 0796 3f3f adc1buf4 071a xxxx rpinr4 0798 3f3f adc1buf5 071c xxxx rpinr5 079a 3f3f adc1buf6 071e xxxx rpinr6 079c 3f3f adc1buf7 0720 xxxx rpinr7 079e 3f3f adc1buf8 0722 xxxx rpinr8 07a0 003f adc1buf9 0724 xxxx rpinr11 07a6 3f3f adc1buf10 0726 xxxx rpinr12 07a8 3f3f adc1buf11 0728 xxxx rpinr14 07ac 3f3f adc1buf12 072a xxxx rpinr15 07ae 003f adc1buf13 072c xxxx rpinr17 07b2 3f00 adc1buf14 072e xxxx rpinr18 07b4 3f3f adc1buf15 0730 xxxx rpinr19 07b6 3f3f adc1buf16 0732 xxxx rpinr20 07b8 3f3f adc1buf17 0734 xxxx rpinr21 07ba 3f3f adc1buf18 0736 xxxx rpinr22 07bc 3f3f adc1buf19 0738 xxxx rpinr23 07be 3f3f adc1buf20 073a xxxx rpinr25 07c2 3f3f adc1buf21 073c xxxx rpinr27 07c6 3f3f adc1buf22 073e xxxx rpinr28 07c8 3f3f adc1buf23 0740 xxxx rpinr29 07ca 003f adc1buf24 0742 xxxx rpor0 07d4 0000 adc1buf25 0744 xxxx rpor1 07d6 0000 ad1con1 0746 0000 rpor2 07d8 0000 ad1con2 0748 0000 rpor3 07da 0000 ad1con3 074a 0000 rpor4 07dc 0000 ad1chs 074c 0000 rpor5 07de 0000 ad1cssh 074e 0000 rpor6 07e0 0000 ad1cssl 0750 0000 rpor7 07e2 0000 ad1con4 0752 0000 rpor8 07e4 0000 ad1con5 0754 0000 rpor9 07e6 0000 ad1chith 0756 0000 rpor10 07e8 0000 ad1chitl 0758 0000 rpor11 07ea 0000 ad1ctmenh 075a 0000 rpor12 07ec 0000 ad1ctmenl 075c 0000 rpor13 07ee 0000 ad1resdma 075e 0000 rpor14 07f0 0000 nvm rpor15 07f2 0000 nvmcon 0760 0000 nvmadr 0762 xxxx nvmadru 0764 00xx nvmkey 0766 0000 legend: = unimplemented, read as 0 ; x = undefined. reset values are shown in hexadecimal. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 72 ? 2015 microchip technology inc. 4.2.5 extended data space (eds) the extended data space (eds) allows pic24f devices to address a much larger range of data than would otherwise be possible with a 16-bit address range. eds includes any additional internal data memory not directly accessible by the lower 32-kbyte data address space and any external memory through epmp. in addition, eds also allows read access to the program memory space. this feature is called program space visibility (psv) and is discussed in detail in section 4.3.3 reading data from program memory using eds . figure 4-4 displays the entire eds space. the eds is organized as pages, called eds pages, with one page equal to the size of the eds window (32 kbytes). a par- ticular eds page is selected through the data space read page register (dsrpag) or the data space write page register (dswpag). for psv, only the dsrpag register is used. the combination of the dsrpag register value and the 16-bit wide data address forms a 24-bit effective address (ea). the data addressing range of the pic24fj1024ga610/ gb610 family devices depends on the version of the enhanced parallel master port implemented on a partic- ular device; this is, in turn , a function of device pin count. tab l e 4 - 1 2 lists the total memory accessible by each of the devices in this family. for more details on accessing external memory using epmp, refer to the dspic33/ pic24 family reference manual , enhanced parallel master port (epmp) (ds39730). . figure 4-4: extended data space table 4-12: total accessible data memory family internal ram external ram access using epmp pic24fjxxxgx610 32k up to 16 mbytes pic24fjxxxgx606 32k up to 64k note: accessing page 0 in the eds window will generate an address error trap as page 0 is the base data memory (data locations, 0800h to 7fffh, in the lower data space). 0000h special registers 32-kbyte eds 8000h program memory dsxpag = 002h dsxpag = 1ffh dsrpag = 200h dsrpag = 3ffh function 018000h 01fffeh 000000h 7f8001h fffffeh 007ffeh 7fffffh program space 0800h fffeh eds pages epmp memory space (1) external memory access using epmp (1) ff8000h dsrpag = 2ffh 7f8000h 7ffffeh access program space access program space access dsrpag = 300h 000001h 007fffh program space access note 1: the range of addressable memory available is dependent on the device pin count and epmp implementation. external memory access using epmp (1) internal data memory space (up to 30 kbytes) (lower word) (lower word) (upper word) (upper word) window dsxpag = 001h 008000h 008800h internal data memory space 2 kbytes downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 73 pic24fj1024ga610/gb610 family 4.2.5.1 data read from eds in order to read the data from the eds space, first, an address pointer is set up by loading the required eds page number into the dsrpag register and assigning the offset address to one of the w registers. once the above assignment is done, the eds window is enabled by setting bit 15 of the working register which is assigned with the offset address; then, the contents of the pointed eds location can be read. figure 4-5 illustrates how the eds space address is generated for read operations. when the most significant bit (msb) of ea is 1 and dsrpag<9> = 0 , the lower 9 bits of dsrpag are con- catenated to the lower 15 bits of ea to form a 24-bit eds space address for read operations. example 4-1 shows how to read a byte, word and double word from eds. figure 4-5: eds address ge neration for read operations example 4-1: eds read code in assembly note: all read operations from eds space have an overhead of one instruction cycle. therefore, a minimum of two instruction cycles are required to complete an eds read. for eds reads under the repeat instruction; the first two accesses take three cycles and the subsequent accesses take one cycle. dsrpag reg select wn 98 15 bits 9 bits 24-bit ea wn<0> is byte select 0 = extended sram and epmp 1 0 ; set the eds page from where the data to be read mov #0x0002, w0 mov w0, dsrpag ;page 2 is selected for read mov #0x0800, w1 ;select the location (0x800) to be read bset w1, #15 ;set the msb of the base address, enable eds mode ;read a byte from the selected location mov.b [w1++], w2 ;read low byte mov.b [w1++], w3 ;read high byte ;read a word from the selected location mov [w1], w2 ; ;read double - word from the selected location mov.d [w1], w2 ;two word read, stored in w2 and w3 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 74 ? 2015 microchip technology inc. 4.2.5.2 data write into eds in order to write data to eds, such as in eds reads, an address pointer is set up by loading the required eds page number into the dswpag register and assigning the offset address to one of the w registers. once the above assignment is done, then the eds window is enabled by setting bit 15 of the working register, assigned with the offset address and the accessed location can be written. figure 4-2 illustrates how the eds address is generated for write operations. when the msbs of ea are 1 , the lower 9 bits of dswpag are concatenated to the lower 15 bits of ea to form a 24-bit eds address for write operations. example 4-2 shows how to write a byte, word and double word to eds. the data space page registers (dsrpag/dswpag) do not update automatically while crossing a page boundary when the rollover happens from 0xffff to 0x8000. while developing code in assembly, care must be taken to update the data space page registers when an address pointer crosses the page boundary. the c compiler keeps track of the addressing, and increments or decrements the page registers accordingly, while accessing contiguous data memory locations. figure 4-6: eds address gene ration for write operations example 4-2: eds write code in assembly note 1: all write operations to eds are executed in a single cycle. 2: use of read/modify/write operation on any eds location under a repeat instruction is not supported. for example, bclr , bsw , btg , rlc f , rlnc f , rrc f , rrnc f , add f , sub f , subr f , and f , ior f , xor f , asr f , asl f . 3: use the dsrpag register while performing read/modify/write operations. dswpag reg select wn 8 15 bits 9 bits 24-bit ea wn<0> is byte select 1 0 ; set the eds page where the data to be written mov #0x0002, w0 mov w0, dswpag ;page 2 is selected for write mov #0x0800, w1 ;select the location (0x800) to be written bset w1, #15 ;set the msb of the base address, enable eds mode ;write a byte to the selected location mov #0x00a5, w2 mov #0x003c, w3 mov.b w2, [w1++] ;write low byte mov.b w3, [w1++] ;write high byte ;write a word to the selected location mov #0x1234, w2 ; mov w2, [w1] ; ;write a double - word to the selected location mov #0x1122, w2 mov #0x4455, w3 mov.d w2, [w1] ;2 eds writes downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 75 pic24fj1024ga610/gb610 family table 4-13: eds memory address with different pages and addresses 4.2.6 software stack apart from its use as a working register, the w15 register in pic24f devices is also used as a software stack pointer (ssp). the pointer always points to the first available free word and grows from lower to higher addresses. it pre-decrements for stack pops and post- increments for stack pushes, as shown in figure 4-7 . note that for a pc push during any call instruction, the msb of the pc is zero-extended before the push, ensuring that the msb is always clear. the stack pointer limit value register (splim), associ- ated with the stack pointer, sets an upper address boundary for the stack. splim is uninitialized at reset. as is the case for the stack pointer, splim<0> is forced to 0 as all stack operations must be word- aligned. whenever an ea is generated using w15 as a source or destination pointer, the resulting address is compared with the value in splim. if the contents of the stack pointer (w15) and the splim register are equal, and a push operation is performed, a stack error trap will not occur. the stack error trap will occur on a subsequent push operation. thus, for example, if it is desirable to cause a stack error trap when the stack grows beyond address 2000h in ram, initialize the splim with the value, 1ffeh. similarly, a stack pointer underflow (stack error) trap is generated when the stack pointer address is found to be less than 0800h. this prevents the stack from interfering with the sfr space. a write to the splim register should not be immediately followed by an indirect read operation using w15. figure 4-7: call stack frame dsrpag (data space read register) dswpag (data space write register) source/destination address while indirect addressing 24-bit ea pointing to eds comment x ( 1 ) x ( 1 ) 0000h to 1fffh 000000h to 001fffh near data space ( 2 ) 2000h to 7fffh 002000h to 007fffh 001h 001h 8000h to ffffh 008000h to 00fffeh epmp memory space 002h 002h 010000h to 017ffeh 003h 1ffh 003h 1ffh 018000h to 0187feh ff8000h to fffffeh 000h 000h invalid address address error trap ( 3 ) note 1: if the source/destination address is below 8000h, the dsrpag and dswpag registers are not considered. 2: this data space can also be accessed by direct addressing. 3: when the source/destination address is above 8000h and dsrpag/dswpag are 0 , an address error trap will occur. note: a pc push during exception processing will concatenate the srl register to the msb of the pc prior to the push. < free word > pc<15:0> 000000000 0 15 w15 ( before call ) w15 ( after call ) stack grows towards higher address 0000h pc<22:16> pop : [--w15] push : [w15++] downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 76 ? 2015 microchip technology inc. 4.3 interfacing program and data memory spaces the pic24f architecture uses a 24-bit wide program space and 16-bit wide data space. the architecture is also a modified harvard scheme, meaning that data can also be present in the program space. to use this data successfully, it must be accessed in a way that preserves the alignment of information in both spaces. aside from normal execution, the pic24f architecture provides two methods by which program space can be accessed during operation: using table instructions to access individual bytes or words anywhere in the program space remapping a portion of the program space into the data space (program space visibility) table instructions allow an application to read or write to small areas of the program memory. this makes the method ideal for accessing data tables that need to be updated from time to time. it also allows access to all bytes of the program word. the remapping method allows an application to access a large block of data on a read-only basis, which is ideal for look-ups from a large table of static data. it can only access the least significant word of the program word. 4.3.1 addressing program space since the address ranges for the data and program spaces are 16 and 24 bits, respectively, a method is needed to create a 23-bit or 24-bit program address from 16-bit data registers. the solution depends on the interface method to be used. for table operations, the 8-bit table memory page address register (tblpag) is used to define a 32k word region within the program space. this is concatenated with a 16-bit ea to arrive at a full 24-bit program space address. in this format, the msbs of tblpag are used to determine if the operation occurs in the user memory (tblpag<7> = 0 ) or the configuration memory (tblpag<7> = 1 ). for remapping operations, the 10-bit extended data space read register (dsrpag) is used to define a 16k word page in the program space. when the most significant bit (msb) of the ea is 1 , and the msb (bit 9) of dsrpag is 1 , the lower 8 bits of dsrpag are concatenated with the lower 15 bits of the ea to form a 23-bit program space address. the dsrpag<8> bit decides whether the lower word (when bit is 0 ) or the higher word (when bit is 1 ) of program memory is mapped. unlike table operations, this strictly limits remapping operations to the user memory area. table 4-14 and figure 4-8 show how the program ea is created for table operations and remapping accesses from the data ea. here, p<23:0> refers to a program space word, whereas d<15:0> refers to a data space word. table 4-14: program space address construction access type access space program space address <23> <22:16> <15> <14:1> <0> instruction access (code execution) user 0 pc<22:1> 0 0xx xxxx xxxx xxxx xxxx xxx0 tblrd/tblwt (byte/word read/write) user tblpag<7:0> data ea<15:0> 0xxx xxxx xxxx xxxx xxxx xxxx configuration tblpag<7:0> data ea<15:0> 1xxx xxxx xxxx xxxx xxxx xxxx program space visibility (block remap/read) user 0 dsrpag<7:0> ( 2 ) data ea<14:0> ( 1 ) 0 xxxx xxxx xxx xxxx xxxx xxxx note 1: data ea<15> is always 1 in this case, but is not used in calculating the program space address. bit 15 of the address is dsrpag<0>. 2: dsrpag<9> is always 1 in this case. dsrpag<8> decides whether the lower word or higher word of program memory is read. when dsrpag<8> is 0 , the lower word is read, and when it is 1 , the higher word is read. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 77 pic24fj1024ga610/gb610 family figure 4-8: data access from program space address generation 0 program counter 23 bits 1 dsrpag<7:0> 8 bits ea 15 bits program counter select tblpag 8 bits ea 16 bits byte select 0 0 1 / 0 user/configuration table operations (2) program space visibility (1) space select 24 bits 23 bits (remapping) 1 / 0 1 / 0 note 1: dsrpag<8> acts as word select. dsrpag<9> should always be 1 to map program memory to data memory. 2: the instructions, tblrdh/tblwth/tblrdl/tblwtl , decide if the higher or lower word of program memory is accessed. tblrdh/tblwth instructions access the higher word and tblrdl/tblwtl instructions access the lower word. table read operations are permit ted in the configuration memory space. 1-bit downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 78 ? 2015 microchip technology inc. 4.3.2 data access from program memory using table instructions the tblrdl and tblwtl instructions offer a direct method of reading or writing the lower word of any address within the program space without going through data space. the tblrdh and tblwth instructions are the only method to read or write the upper 8 bits of a program space word as data. the pc is incremented by two for each successive 24-bit program word. this allows program memory addresses to directly map to data space addresses. program memory can thus be regarded as two, 16-bit word-wide address spaces, residing side by side, each with the same address range. tblrdl and tblwtl access the space which contains the least significant data word, and tblrdh and tblwth access the space which contains the upper data byte. two table instructions are provided to move byte or word-sized (16-bit) data to and from program space. both function as either byte or word operations. 1. tblrdl (table read low): in word mode, it maps the lower word of the program space location (p<15:0>) to a data address (d<15:0>). in byte mode, either the upper or lower byte of the lower program word is mapped to the lower byte of a data address. the upper byte is selected when byte select is 1 ; the lower byte is selected when it is 0 . 2. tblrdh (table read high): in word mode, it maps the entire upper word of a program address (p<23:16>) to a data address. note that d<15:8>, the phantom byte, will always be 0 . in byte mode, it maps the upper or lower byte of the program word to d<7:0> of the data address, as above. note that the data will always be 0 when the upper phantom byte is selected (byte select = 1 ). in a similar fashion, two table instructions, tblwth and tblwtl , are used to write individual bytes or words to a program space address. the details of their operation are described in section 6.0 flash program memory . for all table operations, the area of program memory space to be accessed is determined by the table memory page address register (tblpag). tblpag covers the entire program memory space of the device, including user and configuration spaces. when tblpag<7> = 0 , the table page is located in the user memory space. when tblpag<7> = 1 , the page is located in configuration space. figure 4-9: accessing program memory with table instructions note: only table read operations will execute in the configuration memory space where device ids are located. table write operations are not allowed. 0 8 16 23 0000000000000000 00000000 00000000 phantom byte tblrdh.b (wn<0> = 0 ) tblrdl.w tblrdl.b (wn<0> = 1 ) tblrdl.b (wn<0> = 0 ) 23 15 0 tblpag 02 000000h 800000h 020000h 030000h program space data ea<15:0> the address for the table operation is determined by the data ea within the page defined by the tblpag register. only read operations are shown; wr ite operations are also valid in the user memory area. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 79 pic24fj1024ga610/gb610 family 4.3.3 reading data from program memory using eds the upper 32 kbytes of data space may optionally be mapped into any 16k word page of the program space. this provides transparent access of stored constant data from the data space without the need to use special instructions (i.e., tblrdl/h ). program space access through the data space occurs when the msb of ea is 1 and the dsrpag<9> is also 1 . the lower 8 bits of dsrpag are concatenated to the wn<14:0> bits to form a 23-bit ea to access pro- gram memory. the dsrpag<8> decides which word should be addressed; when the bit is 0 , the lower word, and when 1 , the upper word of the program memory is accessed. the entire program memory is divided into 512 eds pages, from 200h to 3ffh, each consisting of 16k words of data. pages, 200h to 2ffh, correspond to the lower words of the program memory, while 300h to 3ffh correspond to the upper words of the program memory. using this eds technique, the entire program memory can be accessed. previously, the access to the upper word of the program memory was not supported. table 4-15 provides the corresponding 23-bit eds address for program memory with eds page and source addresses. for operations that use psv and are executed outside a repeat loop, the mov and mov.d instructions will require one instruction cycle in addition to the specified execution time. all other instructions will require two instruction cycles in addition to the specified execution time. for operations that use psv, which are executed inside a repeat loop, there will be some instances that require two instruction cycles in addition to the specified execution time of the instruction: execution in the first iteration execution in the last iteration execution prior to exiting the loop due to an interrupt execution upon re-entering the loop after an interrupt is serviced any other iteration of the repeat loop will allow the instruction accessing data, using psv, to execute in a single cycle. table 4-15: eds program address with different pages and addresses example 4-3: eds read code from program memory in assembly dsrpag (data space read register) source address while indirect addressing 23-bit ea pointing to eds comment 200h 2ffh 8000h to ffffh 000000h to 007ffeh 7f8000h to 7ffffeh lower words of 4m program instructions; (8 mbytes) for read operations only. 300h 3ffh 000001h to 007fffh 7f8001h to 7fffffh upper words of 4m program instructions (4 mbytes remaining; 4 mbytes are phantom bytes) for read operations only. 000h invalid address address error trap. ( 1 ) note 1: when the source/destination address is above 8000h and dsrpag/dswpag is 0 , an address error trap will occur. ; set the eds page from where the data to be read mov #0x0202, w0 mov w0, dsrpag ;page 0x202, consisting lower words, is selected for read mov #0x000a, w1 ;select the location (0x0a) to be read bset w1, #15 ;set the msb of the base address, enable eds mode ;read a byte from the selected location mov.b [w1++], w2 ;read low byte mov.b [w1++], w3 ;read high byte ;read a word from the selected location mov [w1], w2 ; ;read double - word from the selected location mov.d [w1], w2 ;two word read, stored in w2 and w3 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 80 ? 2015 microchip technology inc. figure 4-10: program space visibility operation to access lower word figure 4-11: program space visibili ty operation to access upper word 23 15 0 dsrpag data space program space 0000h8000h ffffh 202h 000000h 7ffffeh 010000h 017ffeh when dsrpag<9:8> = 10 and ea<15> = 1 eds window the data in the page designated by dsrpag is mapped into the upper half of the data memory space.... data ea<14:0> ...while the lower 15 bits of the ea specify an exact address within the eds area. this corre- sponds exactly to the same lower 15 bits of the actual program space address. 23 15 0 dsrpag data space program space 0000h8000h ffffh 302h 000000h 7ffffeh 010001h 017fffh when dsrpag<9:8> = 11 and ea<15> = 1 the data in the page designated by dsrpag is mapped into the upper half of the data memory space.... data ea<14:0> ...while the lower 15 bits of the ea specify an exact address within the eds area. this corre- sponds exactly to the same lower 15 bits of the actual program space address. eds window downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 81 pic24fj1024ga610/gb610 family 5.0 direct memory access controller (dma) the direct memory access controller (dma) is designed to service high-throughput data peripherals operating on the sfr bus, allowing them to access data memory directly and alleviating the need for cpu intensive man- agement. by allowing these data intensive peripherals to share their own data path, the main data bus is also deloaded, resulting in additional power savings. the dma controller functions both as a peripheral and a direct extension of the cpu. it is located on the microcontroller data bus between the cpu and dma- enabled peripherals, with direct access to sram. this partitions the sfr bus into two buses, allowing the dma controller access to the dma capable peripherals located on the new dma sfr bus. the controller serves as a master device on the dma sfr bus, controlling data flow from dma capable peripherals. the controller also monitors cpu instruction process- ing directly, allowing it to be aware of when the cpu requires access to peripherals on the dma bus and automatically relinquishing control to the cpu as needed. this increases the effective bandwidth for handling data without dma operations causing a processor stall. this makes the controller essentially transparent to the user. the dma controller has these features: eight multiple independent and independently programmable channels concurrent operation with the cpu (no dma caused wait states) dma bus arbitration five programmable address modes four programmable transfer modes four flexible internal data transfer modes byte or word support for data transfer 16-bit source and destination address register for each channel, dynamically updated and reloadable 16-bit transaction count register, dynamically updated and reloadable upper and lower address limit registers counter half-full level interrupt software triggered transfer null write mode for symmetric buffer operations a simplified block diagram of the dma controller is shown in figure 5-1 . figure 5-1: dma funct ional block diagram note: this data sheet summarizes the features of the pic24fj1024ga610/gb610 family of devices. it is not intended to be a comprehensive reference source. to com- plement the information in this data sheet, refer to the dspic33/pic24 family refer- ence manual , direct memory access controller (dma) (ds39742), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. to i / o p o r ts to dma-enabled peripherals and peripherals dmach0 dmaint0 dmasrc0 dmadst0 dmacnt0 dmach1 dmaint1 dmasrc1 dmadst1 dmacnt1 dmach6 dmaint6 dmasrc6 dmadst6 dmacnt6 dmach7 dmaint7 dmasrc7 dmadst7 dmacnt7 dmacon dmah dmal dmabuf channel 0 channel 1 channel 6 channel 7 data ram address generation data ram control logic data bus cpu execution monitoring downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 82 ? 2015 microchip technology inc. 5.1 summary of dma operations the dma controller is capable of moving data between addresses according to a number of different parameters. each of these parameters can be independently config- ured for any transaction; in addition, any or all of the dma channels can independently perform a different transaction at the same time. transactions are classified by these parameters: source and destination (sfrs and data ram) data size (byte or word) trigger source transfer mode (one-shot, repeated or continuous) addressing modes (fixed address or address blocks, with or without address increment/ decrement) in addition, the dma controller provides channel priority arbitration for all channels. 5.1.1 source and destination using the dma controller, data may be moved between any two addresses in the data space. the sfr space (0000h to 07ffh), or the data ram space (0800h to ffffh), can serve as either the source or the destina- tion. data can be moved between these areas in either direction or between addresses in either area. the four different combinations are shown in figure 5-2 . if it is necessary to protect areas of data ram, the dma controller allows the user to set upper and lower address boundaries for operations in the data space above the sfr space. the boundaries are set by the dmah and dmal limit registers. if a dma channel attempts an operation outside of the address boundaries, the transaction is terminated and an interrupt is generated. 5.1.2 data size the dma controller can handle both 8-bit and 16-bit transactions. size is user-selectable using the size bit (dmachn<1>). by default, each channel is configured for word-sized transactions. when byte-sized transac- tions are chosen, the lsb of the source and/or destination address determines if the data represents the upper or lower byte of the data ram location. 5.1.3 trigger source the dma controller can use any one of the devices interrupt sources to initiate a transaction. the dma trigger sources are listed in reverse order of their natural interrupt priority and are shown in table 5-1 . since the source and destination addresses for any transaction can be programmed independently of the trigger source, the dma controller can use any trigger to perform an operation on any peripheral. this also allows dma channels to be cascaded to perform more complex transfer operations. 5.1.4 transfer mode the dma controller supports four types of data transfers, based on the volume of data to be moved for each trigger. one-shot: a single transaction occurs for each trigger. continuous: a series of back-to-back transactions occur for each trigger; the number of transactions is determined by the dmacntn transaction counter. repeated one-shot: a single transaction is performed repeatedly, once per trigger, until the dma channel is disabled. repeated continuous: a series of transactions are performed repeatedly, one cycle per trigger, until the dma channel is disabled. all transfer modes allow the option to have the source and destination addresses, and counter value automat- ically reloaded after the completion of a transaction. repeated mode transfers do this automatically. 5.1.5 addressing modes the dma controller also supports transfers between single addresses or address ranges. the four basic options are: fixed-to-fixed: between two constant addresses fixed-to-block: from a constant source address to a range of destination addresses block-to-fixed: from a range of source addresses to a single, constant destination address block-to-block: from a range to source addresses to a range of destination addresses the option to select auto-increment or auto-decrement of source and/or destination addresses is available for block addressing modes. in addition to the four basic modes, the dma controller also supports peripheral indirect addressing (pia) mode, where the source or destination address is gen- erated jointly by the dma controller and a pia capable peripheral. when enabled, the dma channel provides a base source and/or destination address, while the peripheral provides a fixed range offset address. for pic24fj1024ga610/gb610 family devices, the 12-bit a/d converter module is the only pia capable peripheral. details for its use in pia mode are provided in section 25.0 12-bit a/d converter with threshold detect . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 83 pic24fj1024ga610/gb610 family figure 5-2: types of dma data transfers sfr area data ram dma ram area sfr area data ram dma ram area sfr area data ram sfr area data ram 07ffh 0800h dmasrcn dmadstn dma ram area dmal dmah 07ffh 0800h dmasrcn dmadstn dmal dmah 07ffh 0800h dmasrcn dmadstn dmal dmah 07ffh 0800h dmasrcn dmadstn dmal dmah dma ram area peripheral to memory memory to peripheral peripheral to peripheral memory to memory note: relative sizes of memory areas are not shown to scale. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 84 ? 2015 microchip technology inc. 5.1.6 channel priority each dma channel functions independently of the others, but also competes with the others for access to the data and dma buses. when access collisions occur, the dma controller arbitrates between the channels using a user-selectable priority scheme. two schemes are available: round-robin: when two or more channels collide, the lower numbered channel receives priority on the first collision. on subsequent colli- sions, the higher numbered channels each receive priority, based on their channel number. fixed: when two or more channels collide, the lowest numbered channel always receives priority, regardless of past history; however, any channel being actively processed is not available for an immediate retrigger. if a higher priority channel is continually requesting service, it will be scheduled for service after the next lower priority channel with a pending request. 5.2 typical setup to set up a dma channel for a basic data transfer: 1. enable the dma controller (dmaen = 1 ) and select an appropriate channel priority scheme by setting or clearing prssel. 2. program dmah and dmal with the appropriate upper and lower address boundaries for data ram operations. 3. select the dma channel to be used and disable its operation (chen = 0 ). 4. program the appropriate source and destination addresses for the transaction into the channels dmasrcn and dmadstn registers. for pia mode addressing, use the base address value. 5. program the dmacntn register for the number of triggers per transfer (one-shot or continu- ous modes) or the number of words (bytes) to be transferred (repeated modes). 6. set or clear the size bit to select the data size. 7. program the trmode<1:0> bits to select the data transfer mode. 8. program the samode<1:0> and damode<1:0> bits to select the addressing mode. 9. enable the dma channel by setting chen. 10. enable the trigger source interrupt. 5.3 peripheral module disable unlike other peripheral modules, the channels of the dma controller cannot be individually powered down using the peripheral module disable (pmd) registers. instead, the channels are controlled as two groups. the dma0md bit (pmd7<4>) selectively controls dmach0 through dmach3. the dma1md bit (pmd7<5>) controls dmach4 through dmach7. setting both bits effectively disables the dma controller. 5.4 registers the dma controller uses a number of registers to con- trol its operation. the number of registers depends on the number of channels implemented for a particular device. there are always four module-level registers (one control and three buffer/address): dmacon: dma engine control register ( register 5-1 ) dmah and dmal: dma high and low address limit registers dmabuf: dma data buffer each of the dma channels implements five registers (two control and three buffer/address): dmachn: dma channel n control register ( register 5-2 ) dmaintn: dma channel n interrupt register ( register 5-3 ) dmasrcn: dma data source address pointer for channel n dmadstn: dma data destination source for channel n dmacntn: dma transaction counter for channel n for pic24fj1024ga610/gb610 family devices, there are a total of 44 registers. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 85 pic24fj1024ga610/gb610 family register 5-1: dmacon: dma engine control register r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 dmaen bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 prssel bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 dmaen: dma module enable bit 1 = enables module 0 = disables module and terminates all active dma operation(s) bit 14-1 unimplemented: read as 0 bit 0 prssel: channel priority scheme selection bit 1 = round-robin scheme 0 = fixed priority scheme downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 86 ? 2015 microchip technology inc. register 5-2: dmachn: dma channel n control register u-0 u-0 u-0 r-0 u-0 r/w-0 r/w-0 r/w-0 n u l l w r e l o a d ( 1 ) chreq ( 3 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 samode1 samode0 damode1 damode0 trmode1 trmode0 size chen bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-13 unimplemented: read as 0 bit 12 reserved: maintain as 0 bit 11 unimplemented: read as 0 bit 10 nullw: null write mode bit 1 = a dummy write is initiated to dmasrcn for every write to dmadstn 0 = no dummy write is initiated bit 9 reload: address and count reload bit ( 1 ) 1 = dmasrcn, dmadstn and dmacntn registers are reloaded to their previous values upon the start of the next operation 0 = dmasrcn, dmadstn and dmacntn are not reloaded on the start of the next operation ( 2 ) bit 8 chreq: dma channel software request bit ( 3 ) 1 = a dma request is initiated by software; automatically cleared upon completion of a dma transfer 0 = no dma request is pending bit 7-6 samode<1:0>: source address mode selection bits 11 = dmasrcn is used in peripheral indirect addressing and remains unchanged 10 = dmasrcn is decremented based on the size bit after a transfer completion 01 = dmasrcn is incremented based on the size bit after a transfer completion 00 = dmasrcn remains unchanged after a transfer completion bit 5-4 damode<1:0>: destination address mode selection bits 11 = dmadstn is used in peripheral indirect addressing and remains unchanged 10 = dmadstn is decremented based on the size bit after a transfer completion 01 = dmadstn is incremented based on the size bit after a transfer completion 00 = dmadstn remains unchanged after a transfer completion bit 3-2 trmode<1:0>: transfer mode selection bits 11 = repeated continuous mode 10 = continuous mode 01 = repeated one-shot mode 00 = one-shot mode bit 1 size: data size selection bit 1 = byte (8-bit) 0 = word (16-bit) bit 0 chen: dma channel enable bit 1 = the corresponding channel is enabled 0 = the corresponding channel is disabled note 1: only the original dmacntn is required to be stored to recover the original dmasrcn and dmadstn. 2: dmasrcn, dmadstn and dmacntn are always reloaded in repeated mode transfers (dmachn<2> = 1 ), regardless of the state of the reload bit. 3: the number of transfers executed while chreq is set depends on the con figuration of trmode<1:0>. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 87 pic24fj1024ga610/gb610 family register 5-3: dmaintn: dma channel n interrupt register r-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 dbufwf ( 1 ) chsel6 chsel5 chsel4 chsel3 chsel2 chsel1 chsel0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 highif ( 1 , 2 ) lowif ( 1 , 2 ) doneif ( 1 ) halfif ( 1 ) ovrunif ( 1 ) h a l f e n bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 dbufwf: dma buffered data write flag bit ( 1 ) 1 = the content of the dma buffer has not been written to the location specified in dmadstn or dmasrcn in null write mode 0 = the content of the dma buffer has been written to the location specified in dmadstn or dmasrcn in null write mode bit 14-8 chsel<6:0>: dma channel trigger selection bits see tab le 5 - 1 for a complete list. bit 7 highif: dma high address limit interrupt flag bit ( 1 , 2 ) 1 = the dma channel has attempted to access an address higher than dmah or the upper limit of the data ram space 0 = the dma channel has not invoked the high address limit interrupt bit 6 lowif: dma low address limit interrupt flag bit ( 1 , 2 ) 1 = the dma channel has attempted to access the dma sfr address lower than dmal, but above the sfr range (07ffh) 0 = the dma channel has not invoked the low address limit interrupt bit 5 doneif: dma complete operation interrupt flag bit ( 1 ) if chen = 1 : 1 = the previous dma session has ended with completion 0 = the current dma session has not yet completed if chen = 0 : 1 = the previous dma session has ended with completion 0 = the previous dma session has ended without completion bit 4 halfif: dma 50% watermark level interrupt flag bit ( 1 ) 1 = dmacntn has reached the halfway point to 0000h 0 = dmacntn has not reached the halfway point bit 3 ovrunif: dma channel overrun flag bit ( 1 ) 1 = the dma channel is triggered while it is still completing the operation based on the previous trigger 0 = the overrun condition has not occurred bit 2-1 unimplemented: read as 0 bit 0 halfen: halfway completion watermark bit 1 = interrupts are invoked when dmacntn has reached its halfway point and at completion 0 = an interrupt is invoked only at the completion of the transfer note 1: setting these flags in software does not generate an interrupt. 2: testing for address limit violations (dmasrcn or dmadstn is either greater than dmah or less than dmal) is not done before the actual access. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 88 ? 2015 microchip technology inc. table 5-1: dma trigger sources chsel<6:0> trigger (interrupt) chsel<6:0> trigger (interrupt) 0000000 off 0110111 uart6 error interrupt 0000001 sccp7 ic/oc interrupt 0111000 uart5 tx interrupt 0000010 sccp7 timer interrupt 0111001 uart5 rx interrupt 0000011 sccp6 ic/oc interrupt 0111010 uart5 error interrupt 0000100 sccp6 timer interrupt 0111011 uart4 tx interrupt 0000101 sccp5 ic/oc interrupt 0111100 uart4 rx interrupt 0000110 sccp5 timer interrupt 0111101 uart4 error interrupt 0000111 sccp4 ic/oc interrupt 0111110 uart3 tx interrupt 0001000 sccp4 timer interrupt 0111111 uart3 rx interrupt 0001011 mccp3 ic/oc interrupt 1000000 uart3 error interrupt 0001100 mccp3 timer interrupt 1000001 uart2 tx interrupt 0001101 mccp2 ic/oc interrupt 1000010 uart2 rx interrupt 0001110 mccp2 timer interrupt 1000011 uart2 error interrupt 0001111 mccp1 ic/oc interrupt 1000100 uart1 tx interrupt 0010000 mccp1 timer interrupt 1000101 uart1 rx interrupt 0010001 oc6 interrupt 1000110 uart1 error interrupt 0010010 oc5 interrupt 1001001 dma channel 7 interrupt 0010011 oc4 interrupt 1001010 dma channel 6 interrupt 0010100 oc3 interrupt 1001011 dma channel 5 interrupt 0010101 oc2 interrupt 1001100 dma channel 4 interrupt 0010110 oc1 interrupt 1001101 dma channel 3 interrupt 0010111 ic6 interrupt 1001110 dma channel 2 interrupt 0011000 ic5 interrupt 1001111 dma channel 1 interrupt 0011001 ic4 interrupt 1010000 dma channel 0 interrupt 0011010 ic3 interrupt 1010001 a/d interrupt 0011011 ic2 interrupt 1010010 usb interrupt 0011100 ic1 interrupt 1010011 pmp interrupt 0100000 spi3 receive interrupt 1010100 hlvd interrupt 0100001 spi3 transmit interrupt 1010101 crc interrupt 0100010 spi3 general interrupt 1011001 clc4 out 0100011 spi2 receive interrupt 1011010 clc3 out 0100100 spi2 transmit interrupt 1011011 clc2 out 0100101 spi2 general interrupt 1011100 clc1 out 0100110 spi1 receive interrupt 1011110 rtcc alarm interrupt 0100111 spi1 transmit interrupt 1011111 tmr5 interrupt 0101000 spi1 general interrupt 1100000 tmr4 interrupt 0101100 i2c3 slave interrupt 1100001 tmr3 interrupt 0101101 i2c3 master interrupt 1100010 tmr2 interrupt 0101110 i2c3 bus collision interrupt 1100011 tmr1 interrupt 0101111 i2c2 slave interrupt 1100110 ctmu trigger 0110000 i2c2 master interrupt 1100111 comparator interrupt 0110001 i2c2 bus collision interrupt 1101000 int4 interrupt 0110010 i2c1 slave interrupt 1101001 int3 interrupt 0110011 i2c1 master interrupt 1101010 int2 interrupt 0110100 i2c1 bus collision interrupt 1101011 int1 interrupt 0110101 uart6 tx interrupt 1101100 int0 interrupt 0110110 uart6 rx interrupt 1101101 interrupt-on-change (ioc) interrupt downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 89 pic24fj1024ga610/gb610 family 6.0 flash program memory the pic24fj1024ga610/gb610 family of devices contains internal flash program memory for storing and executing application code. the program memory is readable, writable and erasable. the flash memory can be programmed in four ways: in-circuit serial programming? (icsp?) run-time self-programming (rtsp) jtag enhanced in-circuit serial programming (enhanced icsp) icsp allows a pic24fj1024ga610/gb610 family device to be serially programmed while in the end application circuit. this is simply done with two lines for the programming clock and programming data (named pgecx and pgedx, respectively), and three other lines for power (v dd ), ground (v ss ) and master clear (mclr ). this allows customers to manufacture boards with unprogrammed devices and then program the microcontroller just before shipping the product. this also allows the most recent firmware or a custom firmware to be programmed. rtsp is accomplished using tblrd (table read) and tblwt (table write) instructions. with rtsp, the user may write program memory data in blocks of 128 instructions (384 bytes) at a time and erase program memory in blocks of 1024 instructions (3072 bytes) at a time. the device implements a 7-bit error correcting code (ecc). the nvm block contains a logic to write and read ecc bits to and from the flash memory. the flash is programmed at the same time as the corresponding ecc parity bits. the ecc provides improved resistance to flash errors. ecc single bit errors can be transparently corrected. ecc double-bit errors (eccdbe) result in a trap. 6.1 table instructions and flash programming regardless of the method used, all programming of flash memory is done with the table read and table write instructions. these allow direct read and write access to the program memory space from the data memory while the device is in normal operating mode. the 24-bit target address in the program memory is formed using the tblpag<7:0> bits and the effective address (ea) from a w register, specified in the table instruction, as shown in figure 6-1 . the tblrdl and the tblwtl instructions are used to read or write to bits<15:0> of program memory. tblrdl and tblwtl can access program memory in both word and byte modes. the tblrdh and tblwth instructions are used to read or write to bits<23:16> of program memory. tblrdh and tblwth can also access program memory in word or byte mode. figure 6-1: addressing for table registers note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference man- ual , pic24f flash program memory (ds30009715), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. 0 program counter 24 bits program tblpag reg 8 bits working reg ea 16 bits using byte 24-bit ea 0 1/0 select table instruction counter using user/configuration space select downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 90 ? 2015 microchip technology inc. 6.2 rtsp operation the pic24f flash program memory array is organized into rows of 128 instructions or 384 bytes. rtsp allows the user to erase blocks of eight rows (1024 instruc- tions) at a time and to program one row at a time. it is also possible to program two instruction word blocks. the 8-row erase blocks and single row write blocks are edge-aligned, from the beginning of program memory, on boundaries of 3072 bytes and 384 bytes, respectively. when data is written to program memory using tblwt instructions, the data is not written directly to memory. instead, data written using table writes is stored in holding latches until the programming sequence is executed. any number of tblwt instructions can be executed and a write will be successfully performed. however, 128 tblwt instructions are required to write the full row of memory. to ensure that no data is corrupted during a write, any unused address should be programmed with ffffffh. this is because the holding latches reset to an unknown state, so if the addresses are left in the reset state, they may overwrite the locations on rows which were not rewritten. the basic sequence for rtsp programming is to set the table pointer to point to the programming latches, do a series of tblwt instructions to load the buffers and set the nvmadru/nvmadr registers to point to the destination. programming is performed by setting the control bits in the nvmcon register. data can be loaded in any order and the holding regis- ters can be written to multiple times before performing a write operation. subsequent writes, however, will wipe out any previous writes. all of the table write operations are single-word writes (2 instruction cycles), because only the buffers are writ- ten. a programming cycle is required for programming each row. 6.3 jtag operation the pic24f family supports jtag boundary scan. boundary scan can improve the manufacturing process by verifying pin to pcb connectivity. 6.4 enhanced in-circuit serial programming enhanced in-circuit serial programming uses an on- board bootloader, known as the program executive (pe), to manage the programming process. using an spi data frame format, the program executive can erase, program and verify program memory. for more information on enhanced icsp, see the device programming specification. 6.5 control registers there are four sfrs used to read and write the program flash memory: nvmcon, nvmadru, nvmadr and nvmkey. the nvmcon register ( register 6-1 ) controls which blocks are to be erased, which memory type is to be programmed and when the programming cycle starts. nvmkey is a write-only register that is used for write protection. to start a pr ogramming or erase sequence, the user must consecutively write 55h and aah to the nvmkey register. refer to section 6.6 programming operations for further details. the nvmadru/nvmadr registers contain the upper byte and lower word of the destination of the nvm write or erase operation. some operations (chip erase, inactive partition erase) operate on fixed locations and do not require an address value. 6.6 programming operations a complete programming sequence is necessary for programming or erasing the internal flash in rtsp mode. during a programming or erase operation, the processor stalls (waits) until the operation is finished. setting the wr bit (nvmcon<15>) starts the opera- tion and the wr bit is automatically cleared when the operation is finished. in dual partition mode, programming or erasing the inactive partition will not stall the processor; the code in the active partition will still execute during the programming operation. it is important to mask interrupts for a minimum of 5 instruction cycles during flash programming. this can be done in assembly using the disi instruction (see example 6-1 ). note: writing to a location multiple times without erasing is not recommended. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 91 pic24fj1024ga610/gb610 family register 6-1: nvmcon: flash memory control register r/s-0, hc ( 1 ) r/w-0 ( 1 ) r-0, hsc ( 1 ) r-0 r-0, hsc ( 1 , 3 ) r-0 ( 1 ) u-0 u-0 wr wren wrerr sftswp p2activ bit 15 bit 8 u-0 u-0 u-0 u-0 r/w-0 ( 1 ) r/w-0 ( 1 ) r/w-0 ( 1 ) r/w-0 ( 1 ) n v m o p 3 ( 2 ) nvmop2 ( 2 ) nvmop1 ( 2 ) nvmop0 ( 2 ) bit 7 bit 0 legend: s = settable bit hc = hardware clearable bit r = reserved bit r = readable bit w = writable bit 0 = bit is cleared x = bit is unknown -n = value at por 1 = bit is set u = unimplemented bit, read as 0 hsc = hardware settable/clearable bit bit 15 wr: write control bit ( 1,4 ) 1 = initiates a flash memory program or erase operation; the operation is self-timed and the bit is cleared by hardware once the operation is complete 0 = program or erase operation is complete and inactive bit 14 wren: write enable bit ( 1 ) 1 = enables flash program/erase operations 0 = inhibits flash program/erase operations bit 13 wrerr: write sequence error flag bit ( 1 ) 1 = an improper program or erase sequence attempt, or termination has occurred (bit is set automatically on any set attempt of the wr bit) 0 = the program or erase operation completed normally bit 12 reserved: maintain as 0 bit 11 sftswp: soft swap status bit ( 1 , 3 ) in single partition m ode: read as 0 . in dual partition m ode: 1 = partitions have been successfully swapped using the bootswp instruction 0 = awaiting successful panel swap using the bootswp instruction bit 10 p2activ: dual partition active status bit ( 1 ) in single partition m ode: read as 0 . in dual partition m ode: 1 = partition 2 is mapped into the active region 0 = partition 1 is mapped into the active region bit 9-4 unimplemented: read as 0 note 1: these bits can only be reset on a power-on reset. 2: all other combinations of nvmop<3:0> are unimplemented. 3: this bit may be cleared by software or by any reset. 4: the wr bit should always be polled to indicate completion during any flash memory program or erase operation while in single partition mode. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 92 ? 2015 microchip technology inc. bit 3-0 nvmop<3:0>: nvm operation select bits ( 1,2 ) 1110 = chip erase user memory (does not erase device id, customer otp or executive memory) 1000 = the next wr command will program fboot with the data held in the first 48 bits of the write latch and then will program the dual partition signature (sign) bit in flash. the device must be reset before the newly programmed mode can take effect. 0100 = erase user memory and configuration words in the inactive partition (dual partition modes only) 0011 = erase a page of program or executive memory 0010 = row programming operation 0001 = double-word programming operation register 6-1: nvmcon: flash memory control register (continued) note 1: these bits can only be reset on a power-on reset. 2: all other combinations of nvmop<3:0> are unimplemented. 3: this bit may be cleared by software or by any reset. 4: the wr bit should always be polled to indicate completion during any flash memory program or erase operation while in single partition mode. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 93 pic24fj1024ga610/gb610 family 6.6.1 programming algorithm for flash program memory the user can program one row of flash program memory at a time. to do this, it is necessary to erase the 8-row erase block containing the desired row. the general process is: 1. read eight rows of program memory (1024 instructions) and store in data ram. 2. update the program data in ram with the desired new data. 3. erase the block (see example 6-1 ): a) set the nvmop<3:0> bits (nvmcon<3:0>) to 0011 to configure for block erase. set the wren (nvmcon<14>) bit. b) write the starting address of the block to be erased into the nvmadru/nvmadr registers. c) write 55h to nvmkey. d) write aah to nvmkey. e) set the wr bit (nvmcon<15>). the erase cycle begins and the cpu stalls for the dura- tion of the erase cycle. when the erase is done, the wr bit is cleared automatically. 4. update the tblpag register to point to the pro- gramming latches on the device. update the nvmadru/nvmadr registers to point to the destination in the program memory. 5. write the first 128 instructions from data ram into the program memory buffers (see table 6-1 ). 6. write the program block to flash memory: a) set the nvmopx bits to 0010 to configure for row programming. set the wren bit. b) write 55h to nvmkey. c) write aah to nvmkey. d) set the wr bit. the programming cycle begins and the cpu stalls for the duration of the write cycle. when the write to flash memory is done, the wr bit is cleared automatically. 7. repeat steps 4 through 6 using the next available 128 instructions from the block in data ram, by incrementing the value in nvmadru/nvmadr, until all 1024 instructions are written back to flash memory. for protection against accidental operations, the write initiate sequence for nvmkey must be used to allow any erase or program operation to proceed. after the programming command has been executed, the user must wait for the programming time until programming is complete. the two instructions following the start of the programming sequence should be nop s, as shown in example 6-2 . table 6-1: example page erase step 1: set the nvmcon register to erase a page. mov #0x4003, w0 mov w0, nvmcon step 2: load the address of the page to be erased into the nvmadr register pair. mov #page_addr_lo, w0 mov w0, nvmadr mov #page_addr_hi, w0 mov w0, nvmadru step 3: set the wr bit. mov #0x55, w0 mov w0, nvmkey mov #0xaa, w0 mov w0, nvmkey bset nvmcon, #wr nop nop nop downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 94 ? 2015 microchip technology inc. example 6-1: erasing a program memo ry block (c language code) example 6-2: initiating a programming sequence // c example using mplab xc16 unsigned long progaddr = 0xxxxxxx; // address of row to write unsigned int offset; //set up pointer to the first memory location to be written nvmadru = progaddr>>16; // initialize pm page boundary sfr nvmadr = progaddr & 0xffff; // initialize lower word of address nvmcon = 0x4003; // initialize nvmcon asm("disi #5"); // block all interrupts with priority <7 // for next 5 instructions __builtin_write_nvm(); // check function to perform unlock // sequence and set wr disi #5 ; block all interrupts with priority <7 ; for next 5 instructions mov.b #0x55, w0 mov w0, nvmkey ; write the 0x55 key mov.b #0xaa, w1 ; mov w1, nvmkey ; write the 0xaa key bset nvmcon, #wr ; start the programming sequence nop ; required delays nop btsc nvmcon, #15 ; and wait for it to be bra $-2 ; completed downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 95 pic24fj1024ga610/gb610 family 6.6.2 programming a double word of flash program memory if a flash location has been erased, it can be pro- grammed using table write instructions to write two instruction words (2 x 24-bit) into the write latch. the tblpag register is loaded with the address of the write latches and the nvmadru/nvmadr registers are loaded with the address of the first of the two instruction words to be programmed. the tblwtl and tblwth instructions write the desired data into the write latches. to configure the nvmcon register for a two-word write, set the nvmopx bits (nvmcon<3:0>) to 0001 . the write is performed by executing the unlock sequence and setting the wr bit. an equivalent procedure in c, using the mplab ? xc16 compiler and built-in hardware functions, is shown in example 6-3 . table 6-2: programming a double word of flash program memory step 1: initialize the tblpag register for writing to the latches. mov #0xfa, w12 mov w12, tblpag step 2: load w0:w2 with the next two packed instruction words to program. mov #, w0 mov #, w1 mov #, w2 step 3: set the read pointer (w6) and write pointer (w7), and load the (next set of) write latches. clr w6 clr w7 tblwtl [w6++], [w7] tblwth.b [w6++], [w7++] tblwth.b [w6++], [++w7] tblwtl.w [w6++], [w7++] step 4: set the nvmadru/nvmadr register pair to point to the correct address. mov #destinationaddress<15:0>, w3 mov #destinationaddress<23:16>, w4 mov w3, nvmadr mov w4, nvmadru step 5: set the nvmcon register to program two instruction words. mov #0x4001, w10 mov w10, nvmcon nop step 6: initiate the write cycle. mov #0x55, w1 mov w1, nvmkey mov #0xaa, w1 mov w1, nvmkey bset nvmcon, #wr nop nop nop downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 96 ? 2015 microchip technology inc. example 6-3: programming a double word of flash program memory (c language code) // c example using mplab xc16 unsigned long progaddr = 0xxxxxxx; // address of word to program unsigned int progdata1l = 0xxxxx; // data to program lower word of word 1 unsigned char progdata1h = 0xxx; // data to program upper byte of word 1 unsigned int progdata2l = 0xxxxx; // data to program lower word of word 2 unsigned char progdata2h = 0xxx; // data to program upper byte of word 2 //set up nvmcon for word programming nvmcon = 0x4001; // initialize nvmcon tblpag = 0xfa; // point tblpag to the write latches //set up pointer to the first memory location to be written nvmadru = progaddr>>16; // initialize pm page boundary sfr nvmadr = progaddr & 0xffff; // initialize lower word of address //perform tblwt instructions to write latches __builtin_tblwtl(0, progdata1l); // write word 1 to address low word __builtin_tblwth(0, progdata2h); // write word 1 to upper byte __builtin_tblwtl(1, progdata2l); // write word 2 to address low word __builtin_tblwth(1, progdata2h); // write word 2 to upper byte asm(disi #5); // block interrupts with priority <7 for next 5 // instructions __builtin_write_nvm(); // xc16 function to perform unlock sequence and set wr downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 97 pic24fj1024ga610/gb610 family 7.0 resets the reset module combines all reset sources and controls the device master reset signal, sysrst . the following is a list of device reset sources: por: power-on reset mclr : master clear pin reset swr: reset instruction wdt: watchdog timer reset bor: brown-out reset cm: configuration mismatch reset trapr: trap conflict reset iopuwr: illegal opcode reset uwr: uninitialized w register reset a simplified block diagram of the reset module is shown in figure 7-1 . any active source of reset will make the sysrst signal active. many registers associated with the cpu and peripherals are forced to a known reset state. most registers are unaffected by a reset; their status is unknown on por and unchanged by all other resets. all types of device reset will set a corresponding status bit in the rcon register to indicate the type of reset (see register 7-1 ). a por will clear all bits, except for the bor and por (rcon<1:0>) bits, which are set. the user may set or clear any bit at any time during code execution. the rcon bits only serve as status bits. setting a particular reset status bit in software will not cause a device reset to occur. the rcon register also has other bits associated with the watchdog timer and device power-saving states. the function of these bits is discussed in other sections of this data sheet. figure 7-1: reset sy stem block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive refer- ence source. for more information, refer to the dspic33/pic24 family reference manual , reset (ds39712), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. note: refer to the specific peripheral or cpu section of this manual for register reset states. note: the status bits in the rcon register should be cleared after they are read so that the next rcon register values after a device reset will be meaningful. mclr v dd v dd rise detect por sleep or idle brown-out reset enable voltage regulator reset instruction wdt module glitch filter bor trap conflict illegal opcode uninitialized w register sysrst configuration mismatch downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 98 ? 2015 microchip technology inc. register 7-1: rcon: re set control register r/w-0 r/w-0 r/w-1 r/w-0 u-0 u-0 r/w-0 r/w-0 trapr ( 1 ) iopuwr ( 1 ) sboren reten ( 2 ) c m ( 1 ) vregs ( 3 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-1 r/w-1 extr ( 1 ) swr ( 1 ) swdten ( 4 ) wdto ( 1 ) sleep ( 1 ) idle ( 1 ) bor ( 1 ) por ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 trapr: trap reset flag bit ( 1 ) 1 = a trap conflict reset has occurred 0 = a trap conflict reset has not occurred bit 14 iopuwr: illegal opcode or uninitialized w access reset flag bit ( 1 ) 1 = an illegal opcode detection, an illegal address mode or uninitialized w register is used as an address pointer and caused a reset 0 = an illegal opcode or uninitialized w register reset has not occurred bit 13 sboren: software enable/disable of bor bit 1 = bor is turned on in software 0 = bor is turned off in software bit 12 reten: retention mode enable bit ( 2 ) 1 = retention mode is enabled while device is in sleep modes (1.2v regulator enabled) 0 = retention mode is disabled bit 11-10 unimplemented: read as 0 bit 9 cm: configuration word mismatch reset flag bit ( 1 ) 1 = a configuration word mismatch reset has occurred 0 = a configuration word mismatch reset has not occurred bit 8 vregs: fast wake-up from sleep bit ( 3 ) 1 = fast wake-up is disabled (uses less power) 0 = fast wake-up is enabled (uses more power) bit 7 extr: external reset (mclr ) pin bit ( 1 ) 1 = a master clear (pin) reset has occurred 0 = a master clear (pin) reset has not occurred bit 6 swr: software reset (instruction) flag bit ( 1 ) 1 = a reset instruction has been executed 0 = a reset instruction has not been executed note 1: all of the reset status bits may be set or cleared in software. setting one of these bits in software does not cause a device reset. 2: if the lpcfg configuration bit is 1 (unprogrammed), the retention regulator is disabled and the reten bit has no effect. retention mode preserves the sram contents during sleep. 3: re-enabling the regulator after it enters standby mode will add a delay, t vreg , when waking up from sleep. applications that do not use the voltage regulator should set this bit to prevent this delay from occurring. 4: if the fwdten<1:0> configuration bits are 11 (unprogrammed), the wdt is always enabled , regardless of the swdten bit setting. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 99 pic24fj1024ga610/gb610 family table 7-1: reset flag bit operation bit 5 swdten: software enable/disable of wdt bit ( 4 ) 1 = wdt is enabled 0 = wdt is disabled bit 4 wdto: watchdog timer time-out flag bit ( 1 ) 1 = wdt time-out has occurred 0 = wdt time-out has not occurred bit 3 sleep: wake from sleep flag bit ( 1 ) 1 = device has been in sleep mode 0 = device has not been in sleep mode bit 2 idle: wake-up from idle flag bit ( 1 ) 1 = device has been in idle mode 0 = device has not been in idle mode bit 1 bor: brown-out reset flag bit ( 1 ) 1 = a brown-out reset has occurred (also set after a power-on reset) 0 = a brown-out reset has not occurred bit 0 por: power-on reset flag bit ( 1 ) 1 = a power-on reset has occurred 0 = a power-on reset has not occurred flag bit setting event clearing event trapr (rcon<15>) trap conflict event por iopuwr (rcon<14>) illegal opcode or uninitialized w register access por cm (rcon<9>) configuration mismatch reset por extr (rcon<7>) mclr reset por swr (rcon<6>) reset instruction por wdto (rcon<4>) wdt time-out clrwdt , pwrsav instruction, por sleep (rcon<3>) pwrsav #0 instruction por idle (rcon<2>) pwrsav #1 instruction por bor (rcon<1>) por, bor por (rcon<0>) por note: all reset flag bits may be set or cleared by the user software. register 7-1: rcon: reset co ntrol register (continued) note 1: all of the reset status bits may be set or cleared in software. setting one of these bits in software does not cause a device reset. 2: if the lpcfg configuration bit is 1 (unprogrammed), the retention regulator is disabled and the reten bit has no effect. retention mode preserves the sram contents during sleep. 3: re-enabling the regulator after it enters standby mode will add a delay, t vreg , when waking up from sleep. applications that do not use the voltage regulator should set this bit to prevent this delay from occurring. 4: if the fwdten<1:0> configuration bits are 11 (unprogrammed), the wdt is always enabled , regardless of the swdten bit setting. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 100 ? 2015 microchip technology inc. 7.1 special function register reset states most of the special function registers (sfrs) associ- ated with the pic24f cpu and peripherals are reset to a particular value at a device reset. the sfrs are grouped by their peripheral or cpu function and their reset values are specified in each section of this manual. the reset value for each sfr does not depend on the type of reset, with the exception of four registers. the reset value for the reset control register, rcon, will depend on the type of device reset. the reset value for the oscillator control register, osccon, will depend on the type of reset and the programmed values of the fnosc<2:0> bits in the foscsel flash configuration word (see table 7-2 ). the nvmcon register is only affected by a por. 7.2 device reset times the reset times for various types of device reset are summarized in tab le 7 - 3 . note that the master reset signal, sysrst , is released after the por delay time expires. the time at which the device actually begins to execute code will also depend on the system oscillator delays, which include the oscillator start-up timer (ost) and the pll lock time. the ost and pll lock times occur in parallel with the applicable sysrst delay times. the fail-safe clock monitor (fscm) delay determines the time at which the fscm begins to monitor the system clock source after the sysrst signal is released. 7.3 brown-out reset (bor) pic24fj1024ga610/gb610 family devices implement a bor circuit that provides the user with several configura- tion and power-saving options. the bor is controlled by the boren<1:0> (fpor<1:0>) configuration bits. when bor is enabled, any drop of v dd below the bor threshold results in a device bor. threshold levels are described in section 33.1 dc characteristics . 7.4 clock source selection at reset if clock switching is enabled, the system clock source at device reset is chosen, as shown in table 7-2 . if clock switching is disabled, the system clock source is always selected according to the oscillator configuration bits. for more information, refer to the dspic33/pic24 family reference manual , oscillator (ds39700). table 7-2: oscillator selection vs. type of reset (clock switching enabled) reset type clock source determinant por fnosc<2:0> configuration bits (foscsel<2:0>) bor mclr cosc<2:0> control bits (osccon<14:12>) wdto swr downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 101 pic24fj1024ga610/gb610 family table 7-3: reset delay times for various device resets reset type clock source sysrst delay system clock delay notes por ec t por + t startup + t rst 1 , 2 , 3 ecpll t por + t startup + t rst t lock 1 , 2 , 3 , 5 xt, hs, sosc t por + t startup + t rst t ost 1 , 2 , 3 , 4 xtpll, hspll t por + t startup + t rst t ost + t lock 1 , 2 , 3 , 4 , 5 frc, oscfdiv t por + t startup + t rst t frc 1 , 2 , 3 , 6 , 7 frcpll t por + t startup + t rst t frc + t lock 1 , 2 , 3 , 5 , 6 lprc t por + t startup + t rst t lprc 1 , 2 , 3 , 6 dco t por + t startup + t rst t dco 1 , 2 , 3 , 8 bor ec t startup + t rst 2 , 3 ecpll t startup + t rst t lock 2 , 3 , 5 xt, hs, sosc t startup + t rst t ost 2 , 3 , 4 xtpll, hspll t startup + t rst t ost + t lock 2 , 3 , 4 , 5 frc, oscfdiv t startup + t rst t frc 2 , 3 , 6 , 7 frcpll t startup + t rst t frc + t lock 2 , 3 , 5 , 6 lprc t startup + t rst t lprc 2 , 3 , 6 dco t por + t startup + t rst t dco 1 , 2 , 3 , 8 mclr any clock t rst 3 wdt any clock t rst 3 software any clock t rst 3 illegal opcode any clock t rst 3 uninitialized w any clock t rst 3 trap conflict any clock t rst 3 note 1: t por = power-on reset delay (10 ? s nominal). 2: t startup = t vreg . 3: t rst = internal state reset time (2 ? s nominal). 4: t ost = oscillator start-up timer (ost). a 10-bit counter counts 1024 oscillator periods before releasing the oscillator clock to the system. 5: t lock = pll lock time. 6: t frc and t lprc = rc oscillator start-up times. 7: if two-speed start-up is enabled, regardless of the primary oscillator selected, the device starts with frc so the system clock delay is just t frc , and in such cases, frc start-up time is valid; it switches to the primary oscillator after its respective clock delay. 8: t dco = dco start-up and stabilization times. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 102 ? 2015 microchip technology inc. 7.4.1 por and long oscillator start-up times the oscillator start-up circuitry and its associated delay timers are not linked to the device reset delays that occur at power-up. some crystal circuits (especially low- frequency crystals) will have a relatively long start-up time. therefore, one or more of the following conditions is possible after sysrst is released: the oscillator circuit has not begun to oscillate. the oscillator start-up timer has not expired (if a crystal oscillator is used). the pll has not achieved a lock (if pll is used). the device will not begin to execute code until a valid clock source has been released to the system. there- fore, the oscillator and pll start-up delays must be considered when the reset delay time must be known. 7.4.2 fail-safe clock monitor (fscm) and device resets if the fscm is enabled, it will begin to monitor the system clock source when sysrst is released. if a valid clock source is not available at this time, the device will automatically switch to the frc oscillator and the user can switch to the desired crystal oscillator in the trap service routine (tsr). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 103 pic24fj1024ga610/gb610 family 8.0 interrupt controller the pic24fj1024ga610/gb610 family interrupt controller reduces the numerous peripheral interrupt request signals to a single interrupt request signal to the pic24fj1024ga610/gb610 family cpu. the interrupt controller has the following features: up to eight processor exceptions and software traps seven user-selectable priority levels interrupt vector table (ivt) with a unique vector for each interrupt or exception source fixed priority within a specified user priority level fixed interrupt entry and return latencies 8.1 interrupt vector table the pic24fj1024ga610/gb610 family interrupt vector table (ivt), shown in figure 8-1 , resides in program memory starting at location, 000004h. the ivt contains 6 non-maskable trap vectors and up to 118 sources of interrupt. in general, each interrupt source has its own vector. each interrupt vector contains a 24-bit wide address. the value programmed into each interrupt vector location is the starting address of the associated interrupt service routine (isr). interrupt vectors are prioritized in terms of their natural priority. this priority is linked to their position in the vector table. lower addresses generally have a higher natural priority. for example, the interrupt associated with vector 0 takes priority over interrupts at any other vector address. 8.2 reset sequence a device reset is not a true exception because the interrupt controller is not involved in the reset process. the pic24fj1024ga610/gb610 family devices clear their registers in response to a reset, which forces the pc to zero. the device then begins program execution at location, 0x000000. a goto instruction at the reset address can redirect program execution to the appropriate start-up routine. note 1: this data sheet summarizes the features of the pic24fj1024ga610/ gb610 family of devices. it is not intended to be a comprehensive reference source. to complement the information in this data sheet, refer to interrupts (ds70000600) in the dspic33/pic24 family reference man- ual , which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. 2: some registers and associated bits described in this section may not be available on all devices. refer to section 4.0 memory organization in this data sheet for device-specific register and bit information. note: any unimplemented or unused vector locations in the ivt should be programmed with the address of a default interrupt handler routine that contains a reset instruction. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 104 ? 2015 microchip technology inc. figure 8-1: pic24fj1024 ga610/gb610 family interrupt vector table ivt decreasing natural order priority reset C goto instruction 0x000000 reset C goto address 0x000002 oscillator fail trap vector 0x000004 address error trap vector 0x000006 generic hard trap vector 0x000008 stack error trap vector 0x00000a math error trap vector 0x00000c reserved 0x00000e generic soft trap vector 0x000010 reserved 0x000012 interrupt vector 0 0x000014 interrupt vector 1 0x000016 :::: :: interrupt vector 52 0x00007c interrupt vector 53 0x00007e interrupt vector 54 0x000080 :::: :: interrupt vector 116 0x0000fc interrupt vector 117 0x0000fe see ta b l e 8 - 1 for interrupt vector details downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 105 pic24fj1024ga610/gb610 family table 8-1: interrupt vector details interrupt source irq # ivt address interrupt bit location flag enable priority highest natural order priority int0 C external interrupt 0 0 000014h ifs0<0> iec0<0> int0interrupt ic1 C input capture 1 1 000016h ifs0<1> iec0<1> ic1interrupt oc1 C output compare 1 2 000018h ifs0<2> iec0<2> oc1interrupt t1 C timer1 3 00001ah ifs0<3> iec0<3> t1interrupt dma0 C direct memory access 0 4 00001ch ifs0<4> iec0<4> dma0interrupt ic2 C input capture 2 5 00001eh ifs0<5> iec0<5> ic2interrupt oc2 C output compare 2 6 000020h ifs0<6> iec0<6> oc2interrupt t2 C timer2 7 000022h ifs0<7> iec0<7> t2interrupt t3 C timer3 8 000024h ifs0<8> iec0<8> t3interrupt spi1 C spi1 general 9 000026h ifs0<9> iec0<9> spi1interrupt spi1tx C spi1 transfer done 10 000028h ifs0<10> iec0<10> spi1txinterrupt u1rx C uart1 receiver 11 00002ah ifs0<11> iec0<11> u1rxinterrupt u1tx C uart1 transmitter 12 00002ch ifs0<12> iec0<12> u1txinterrup t adc1 C a/d converter 1 13 00002eh ifs0<13> iec0<13> adc1interrupt dma1 C direct memory access 1 14 000030h ifs0<14> iec0<14> dma1interrupt nvm C nvm program/erase complete 15 000032h ifs0<15> iec0<15> nvminterrupt si2c1 C i2c1 slave events 16 000034h ifs1<0> iec1<0> si2c1interrupt mi2c1 C i2c1 master events 17 000036h ifs1<1> iec1<1> mi2c1interrupt comp C comparator 18 000038h ifs1<2> iec1<2> compinterrupt ioc C interrupt-on-change interrupt 19 00003ah ifs1<3> iec1<3> iocinterrupt int1 C external interrupt 1 20 00003ch ifs1<4> iec1<4> int1interrupt 2 1 ccp5 C capture/compare 5 22 000040h ifs1<6> iec1<6> ccp5interrupt ccp6 C capture/compare 6 23 000042h ifs1<7> iec1<7> ccp6interrupt dma2 C direct memory access 2 24 000044h ifs1<8> iec1<8> dma2interrupt oc3 C output compare 3 25 000046h ifs1<9> iec1<9> oc3interrupt oc4 C output compare 4 26 000048h ifs1<10> iec1<10> oc4interrupt t4 C timer4 27 00004ah ifs1<11> iec1<11> t4interrupt t5 C timer5 28 00004ch ifs1<12> iec1<12> t5interrupt int2 C external interrupt 2 29 00004eh ifs1<13> iec1<13> int2interrupt u2rx C uart2 receiver 30 000050h ifs1<14> iec1<14> u2rxinterrupt u2tx C uart2 transmitter 31 000052h ifs1<15> iec1<15> u2txinterrupt spi2 C spi2 general 32 000054h ifs2<0> iec2<0> spi2interrupt spi2tx C spi2 transfer done 33 000056h ifs2<1> iec2<1> spi2txinterrupt 3 4 3 5 dma3 C direct memory access 3 36 00005ch ifs2<4> iec2<4> dma3interrupt ic3 C input capture 3 37 00005eh ifs2<5> iec2<5> ic3interrupt ic4 C input capture 4 38 000060h ifs2<6> iec2<6> ic4interrupt ic5 C input capture 5 39 000062h ifs2<7> iec2<7> ic5interrupt ic6 C input capture 6 40 000064h ifs2<8> iec2<8> ic6interrupt downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 106 ? 2015 microchip technology inc. oc5 C output compare 5 41 000066h ifs2<9> iec2<9> oc5interrupt oc6 C output compare 6 42 000068h ifs2<10> iec2<10> oc6interrupt cct3 C capture/compare timer3 43 00006ah ifs2<11> iec2<11> cct3interrupt cct4 C capture/compare timer4 44 00006ch ifs2<12> iec2<12> cct4interrupt pmp C parallel master port 45 00006eh ifs2<13> iec2<13> pmpinterrupt dma4 C direct memory access 4 46 000070h ifs2<14> iec2<14> dma4interrupt cct5 C capture/compare timer5 47 000072h ifs2<15> iec2<15> cct5interrupt cct6 C capture/compare timer6 48 000074h ifs3<0> iec3<0> cct6interrupt si2c2 C i2c2 slave events 49 000076h ifs3<1> iec3<1> si2c2interrupt mi2c2 C i2c2 master events 50 000078h ifs3<2> iec3<2> mi2c2interrupt cct7 C capture/compare timer7 51 00007ah ifs3<3> iec3<3> cct7interrupt 5 2 int3 C external interrupt 3 53 00007eh ifs3<5> iec3<5> int3interrupt int4 C external interrupt 4 54 000080h ifs3<6> iec3<6> int4interrupt 5 5 5 6 5 7 spi1rx C spi1 receive done 58 000088h ifs3<10> iec3<10> spi1rxinterrupt spi2rx C spi2 receive done 59 00008ah ifs3<11> iec3<11> spi2rxinterrupt spi3rx C spi3 receive done 60 00008ch ifs3<12> iec3<12> spi3rxinterrupt dma5 C direct memory access 5 61 00008eh ifs3<13> iec3<13> dma5interrupt rtcc C real-time clock and calendar 62 000090h ifs3<14> iec3<14> rtccinterrupt ccp1 C capture/compare 1 63 000092h ifs3<15> iec3<15> ccp1interrupt ccp2 C capture/compare 2 64 000094h ifs4<0> iec4<0> ccp2interrupt u1e C uart1 error 65 000096h ifs4<1> iec4<1> u1errinterrupt u2e C uart2 error 66 000098h ifs4<2> iec4<2> u2errinterrupt crc C cyclic redundancy check 67 00009ah ifs4<3> iec4<3> crcinterrupt dma6 C direct memory access 6 68 00009ch ifs4<4> iec4<4> dma6interrupt dma7 C direct memory access 7 69 00009eh ifs4<5> iec4<5> dma7interrupt si2c3 C i2c3 slave events 70 0000a0h ifs4<6> iec4<6> si2c3interrupt mi2c3 C i2c3 master events 71 0000a2h ifs4<7> iec4<7> mi2c3interrupt hlvd C high/low-voltage detect 72 0000a4h ifs4<8> iec4<8> hlvdinterrupt ccp7 C capture/compare 7 73 0000a6h ifs4<9> iec4<9> ccp7interrupt 7 4 7 4 7 5 7 5 7 6 7 6 ctmu C interrupt 77 0000aeh ifs4<13> iec4<13> ctmuinterrupt 7 8 7 8 7 9 7 9 8 0 8 0 u3e C uart3 error 81 0000b6h ifs5<1> iec5<1> u3errinterrupt u3rx C uart3 receiver 82 0000b8h ifs5<2> iec5<2> u3rxinterrupt u3tx C uart3 transmitter 83 0000bah ifs5<3> iec5<3> u3txinterrupt table 8-1: interrupt vector details (continued) interrupt source irq # ivt address interrupt bit location flag enable priority downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 107 pic24fj1024ga610/gb610 family i2c1bc C i2c1 bus collision 84 0000bch ifs5<4> iec5<4> i2c1bcinterrupt i2c2bc C i2c2 bus collision 85 0 000beh ifs5<5> iec5<5> i2c2bcinterrupt usb1 C usb1 interrupt 86 0000c0h ifs5<6> iec5<6> usb1interrupt u4e C uart4 error 87 0000c2h ifs5<7> iec5<7> u4errinterrupt u4rx C uart4 receiver 88 0000c4h ifs5<8> iec5<8> u4rxinterrupt u4tx C uart4 transmitter 89 0000c6h ifs5<9> iec5<9> u4txinterrupt spi3 C spi3 general 90 0000c8h ifs5<10> iec5<10> spi3interrupt spi3tx C spi3 transfer done 91 0000cah ifs5<11> iec5<11> spi3txinterrupt 9 2 9 2 9 3 9 3 ccp3 C capture/compare 3 94 0000d0h ifs5<14> iec5<14> ccp3interrupt ccp4 C capture/compare 4 95 0000d2h ifs5<15> iec5<15> ccp4interrupt clc1 C configurable logic cell 1 96 0000d4h ifs6<0> iec6<0> clc1interrupt clc2 C configurable logic cell 2 97 0000d6h ifs6<1> iec6<1> clc2interrupt clc3 C configurable logic cell 3 98 0000d8h ifs6<2> iec6<2> clc3interrupt clc4 C configurable logic cell 4 99 0000dah ifs6<3> iec6<3> clc4interrupt 1 0 0 cct1 C capture/compare timer1 101 0000deh ifs6<5> iec6<5> cct1interrupt cct2 C capture/compare timer2 102 0000e0h ifs6<6> iec6<6> cct2interrupt 1 0 3 1 0 4 1 0 5 fst C frc self-tuning interrupt 106 0000e8h ifs6<10> iec6<10> fstinterrupt 1 0 7 1 0 8 i2c3bc C i2c3 bus collision 109 0000eeh ifs6<13> iec6<13> i2c3bcinterrupt rtccts C real-time clock timestamp 110 0000f0h ifs6<14> iec6<14> rtcctsinterrupt u5rx C uart5 receiver 111 0000f2h ifs6<15> iec6<15> u5rxinterrupt u5tx C uart5 transmitter 112 0000f4h ifs7<0> iec7<0> u5txinterrupt u5e C uart5 error 113 0000f6h ifs7<1> iec7<1> u5errinterrupt u6rx C uart6 receiver 114 0000f8h ifs7<2> iec7<2> u6rxinterrupt u6tx C uart6 transmitter 115 0000fah ifs7<3> iec7<3> u6txinterrupt u6e C uart6 error 116 0000fch ifs7<4> iec7<4> u6errinterrupt jtag C jtag 117 0000feh ifs7<5> iec7<5> jtaginterrupt table 8-1: interrupt vector details (continued) interrupt source irq # ivt address interrupt bit location flag enable priority downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 108 ? 2015 microchip technology inc. 8.3 interrupt resources many useful resources are provided on the main prod- uct page of the microchip web site for the devices listed in this data sheet. this product page, which can be accessed using this link , contains the latest updates and additional information. 8.3.1 key resources interrupts (ds70000600) in the dspic33/pic24 family reference manual code samples application notes software libraries webinars all related dspic33/pic24 family reference manual sections development tools 8.4 interrupt control and status registers pic24fj1024ga610/gb610 family devices implement the following registers for the interrupt controller: intcon1 intcon2 intcon4 inttreg 8.4.1 intcon1 through intcon4 global interrupt control functions are controlled from intcon1, intcon2 and intcon4. intcon1 contains the interrupt nesting disable bit (nstdis), as well as the control and status flags for the processor trap sources. the intcon2 register controls external interrupt request signal behavior and also contains the global interrupt enable bit (gie). the intcon4 register contains the software generated hard trap bit (sght) and ecc double-bit error (eccdbe) trap. 8.4.2 ifsx the ifsx registers maintain all of the interrupt request flags. each source of interrupt has a status bit, which is set by the respective peripherals or external signal, and is cleared via software. 8.4.3 iecx the iecx registers maintain all of the interrupt enable bits. these control bits are used to individually enable interrupts from the peripherals or external signals. 8.4.4 ipcx the ipcx registers are used to set the interrupt priority level (ipl) for each source of interrupt. each user interrupt source can be assigned to one of eight priority levels. 8.4.5 inttreg the inttreg register contains the associated interrupt vector number and the new cpu interrupt priority level, which are latched into the vector number bits (vecnum<7:0>) and interrupt priority level bits (ilr<3:0>) fields in the inttreg register. the new interrupt priority level is the priority of the pending interrupt. the interrupt sources are assigned to the ifsx, iecx and ipcx registers in the same sequence as they are listed in table 8-1 . for example, the int0 (external interrupt 0) is shown as having vector number 8 and a natural order priority of 0. thus, the int0if bit is found in ifs0<0>, the int0ie bit in iec0<0> and the int0ip bits in the first position of ipc0 (ipc0<2:0>). 8.4.6 status/control registers although these registers are not specifically part of the interrupt control hardware, two of the cpu control registers contain bits that control interrupt functionality. for more information on these registers refer to cpu with extended data space (eds) (ds39732) in the dspic33/pic24 family reference manual . the cpu status register, sr, contains the ipl<2:0> bits (sr<7:5>). these bits indicate the current cpu interrupt priority level. the user software can change the current cpu interrupt priority level by writing to the iplx bits. the corcon register contains the ipl3 bit, which together with the ipl<2:0> bits, also indi- cates the current cpu interrupt priority level. ipl3 is a read-only bit so that trap events cannot be masked by the user software. all interrupt registers are described in register 8-3 through register 8-6 in the following pages. note: in the event you are not able to access the product page using the link above, enter this url in your browser: http://www.microchip.com/wwwproducts/ devices.aspx?ddocname=en555464 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 109 pic24fj1024ga610/gb610 family register 8-1: sr: alu status register ( 1 ) u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 dc bit 15 bit 8 r/w-0 ( 3 ) r/w-0 ( 3 ) r/w-0 ( 3 ) r-0 r/w-0 r/w-0 r/w-0 r/w-0 ipl2 ( 2 ) ipl1 ( 2 ) ipl0 ( 2 ) ra n ov z c bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1= bit is set 0 = bit is cleared x = bit is unknown bit 7-5 ipl<2:0>: cpu interrupt priority level status bits ( 2 , 3 ) 111 = cpu interrupt priority level is 7 (15); user interrupts are disabled 110 = cpu interrupt priority level is 6 (14) 101 = cpu interrupt priority level is 5 (13) 100 = cpu interrupt priority level is 4 (12) 011 = cpu interrupt priority level is 3 (11) 010 = cpu interrupt priority level is 2 (10) 001 = cpu interrupt priority level is 1 (9) 000 = cpu interrupt priority level is 0 (8) note 1: for complete register details, see register 3-1 . 2: the ipl<2:0> status bits are concatenated with the ipl3 status bit (corcon<3>) to form the cpu interrupt priority level (ipl). the value in parentheses indicates the ipl when ipl3 = 1 . user interrupts are disabled when ipl3 = 1 . 3: the ipl<2:0> status bits are read-only when the nstdis bit (intcon1<15>) = 1 . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 110 ? 2015 microchip technology inc. register 8-2: corcon: cp u core control register ( 1 ) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 u-0 r/c-0 r/w-1 u-0 u-0 i p l 3 ( 2 ) psv bit 7 bit 0 legend: c = clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1= bit is set 0 = bit is cleared x = bit is unknown bit 15-4 unimplemented: read as 0 bit 3 ipl3: cpu interrupt priority level status bit ( 2 ) 1 = cpu interrupt priority level is greater than 7 0 = cpu interrupt priority level is 7 or less bit 2 psv: not used as part of the interrupt module bit 1-0 unimplemented: read as 0 note 1: for complete register details, see register 3-2 . 2: the ipl<2:0> status bits are concatenated with the ipl3 status bit (corcon<3>) to form the cpu interrupt priority level (ipl). the value in parentheses indicates the ipl when ipl3 = 1 . user interrupts are disabled when ipl3 = 1 . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 111 pic24fj1024ga610/gb610 family register 8-3: intcon1: in terrupt control register 1 r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 nstdis bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 matherr addrerr stkerr oscfail bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 nstdis: interrupt nesting disable bit 1 = interrupt nesting is disabled 0 = interrupt nesting is enabled bit 14-5 unimplemented: read as 0 bit 4 matherr: math error status bit 1 = math error trap has occurred 0 = math error trap has not occurred bit 3 addrerr: address error trap status bit 1 = address error trap has occurred 0 = address error trap has not occurred bit 2 stkerr: stack error trap status bit 1 = stack error trap has occurred 0 = stack error trap has not occurred bit 1 oscfail: oscillator failure trap status bit 1 = oscillator failure trap has occurred 0 = oscillator failure trap has not occurred bit 0 unimplemented: read as 0 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 112 ? 2015 microchip technology inc. register 8-4: intcon2: in terrupt control register 2 r/w-1 r-0 r/w-0 u-0 u-0 u-0 u-0 r/w-0 gie disi swtrap a i v t e n bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 int4ep int3ep int2ep int1ep int0ep bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 gie: global interrupt enable bit 1 = interrupts and associated interrupt enable bits are enabled 0 = interrupts are disabled, but traps are still enabled bit 14 disi: disi instruction status bit 1 = disi instruction is active 0 = disi instruction is not active bit 13 swtrap: software trap status bit 1 = software trap is enabled 0 = software trap is disabled bit 12-9 unimplemented: read as 0 bit 8 aivten: alternate interrupt vector table enable bit 1 = use alternate interrupt vector table (if enabled in configuration bits) 0 = use standard interrupt vector table (default) bit 7-5 unimplemented: read as 0 bit 4 int4ep: external interrupt 4 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge bit 3 int3ep: external interrupt 3 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge bit 2 int2ep: external interrupt 2 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge bit 1 int1ep: external interrupt 1 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge bit 0 int0ep: external interrupt 0 edge detect polarity select bit 1 = interrupt on negative edge 0 = interrupt on positive edge downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 113 pic24fj1024ga610/gb610 family register 8-5: intcon4: in terrupt control register 4 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 r/c-0 r/c-0 eccdbe sght bit 7 bit 0 legend: c = clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-2 unimplemented: read as 0 bit 1 eccdbe: ecc double-bit error trap bit 1 = ecc double-bit error trap has occurred 0 = ecc double-bit error trap has not occurred bit 0 sght: software generated hard trap status bit 1 = software generated hard trap has occurred 0 = software generated hard trap has not occurred downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 114 ? 2015 microchip technology inc. register 8-6: inttreg: interrupt control and status register r-0 u-0 r/w-0 u-0 r-0 r-0 r-0 r-0 cpuirq v h o l d ilr3 ilr2 ilr1 ilr0 bit 15 bit 8 r-0 r-0 r-0 r-0 r-0 r-0 r-0 r-0 vecnum7 vecnum6 vecnum5 vecnum4 vecnum3 vecnum2 vecnum1 vecnum0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 cpuirq: interrupt request from interrupt controller cpu bit 1 = an interrupt request has occurred but has not yet been acknowledged by the cpu; this happens when the cpu priority is higher than the interrupt priority 0 = no interrupt request is unacknowledged bit 14 unimplemented: read as 0 bit 13 vhold: vector number capture configuration bit 1 = the vecnumx bits contain the value of the highest priority pendi ng interrupt 0 = the vecnumx bits contain the value of the last acknowledged interrupt (i.e., the last interrupt that has occurred with higher priority than the cpu, even if other interrupts are pending) bit 12 unimplemented: read as 0 bit 11-8 ilr<3:0>: new cpu interrupt priority level bits 1111 = cpu interrupt priority level is 15 0001 = cpu interrupt priority level is 1 0000 = cpu interrupt priority level is 0 bit 7-0 vecnum<7:0>: vector number of pending interrupt bits 11111111 = 255, reserved; do not use 00001001 = 9, ic1 C input capture 1 00001000 = 8, int0 C external interrupt 0 00000111 = 7, reserved; do not use 00000110 = 6, generic soft error trap 00000101 = 5, reserved; do not use 00000100 = 4, math error trap 00000011 = 3, stack error trap 00000010 = 2, generic hard trap 00000001 = 1, address error trap 00000000 = 0, oscillator fail trap downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 115 pic24fj1024ga610/gb610 family 9.0 oscillator configuration the oscillator system for the pic24fj1024ga610/ gb610 family devices has the following features: a total of five external and internal oscillator options as clock sources, providing 12 different clock modes an on-chip usb pll block to provide a stable 48 mhz clock for the usb module, as well as a range of frequency options for the system clock software-controllable switching between various clock sources software-controllable postscaler for selective clocking of cpu for system power savings a fail-safe clock monitor (fscm) that detects clock failure and permits safe application recovery or shutdown a separate and independently configurable system clock output for synchronizing external hardware a simplified diagram of the oscillator system is shown in figure 9-1 . figure 9-1: pic24fj1024ga610/gb610 family clock diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive refer- ence source. for more information, refer to the dspic33/pic24 family reference manual , oscillator (ds39700), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. pic24fj1024ga610/gb610 family secondary oscillator soscen enable oscillator sosco sosci clock source options for other modules osci osco primary oscillator xt, hs, ec cpu peripherals rcdiv<2:0> wdt, pwrt oscfdiv sosc clock control logic fscm doze<14:12> clko xtpll, hspll ecpll,frcpll pll & div pllmode<3:0> cpdiv<1:0> 48 mhz usb clock usb pll dco ccp dco lprc frc self-tune control usb frc div<14:0> lprc oscillator frc divider n postscaler downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 116 ? 2015 microchip technology inc. 9.1 cpu clocking scheme the system clock source can be provided by one of five sources: primary oscillator (posc) on the osci and osco pins secondary oscillator (sosc) on the sosci and sosco pins digitally controlled oscillator (dco) fast internal rc (frc) oscillator low-power internal rc (lprc) oscillator the primary oscillator and frc sources have the option of using the internal pll block, which can gen- erate a 96 mhz usb module pll clock, or a 4x, 6x or 8x pll clock. if the 96 mhz pll is used, the pll clocks can then be postscaled, if necessary, and used as the system clock. if the 4x, 6x or 8x pll multipliers are selected, the pll clock can be used directly as a system clock. refer to section 9.6 oscillator modes and usb operation for additional information. the internal frc provides an 8 mhz clock source. each clock source (posc, sosc, dco, frc and lprc) can be used as an input to an additional divider, which can then be used to produce a divided clock source for use as a system clock (oscfdiv). the selected clock source generates the processor and peripheral clock sources. the processor clock source is divided by two to produce the internal instruc- tion cycle clock, f cy . in this document, the instruction cycle clock is also denoted by f osc /2. the internal instruction cycle clock, f osc /2, can be provided on the osco i/o pin for some operating modes of the primary oscillator. 9.2 initial configuration on por the oscillator source (and operating mode) that is used at a device power-on reset event is selected using con- figuration bit settings. the oscillator configuration bit settings are located in the configuration registers in the program memory (refer to section 30.1 configuration bits for further details). the primary oscillator configuration bits, poscmd<1:0> (fosc<1:0>), and the initial oscillator select configuration bits, fnosc<2:0> (foscsel<2:0>), select the oscillator source that is used at a power-on reset. the oscfdiv clock source is the default (unprogrammed) selection; the default input source to the oscfdiv divider is the frc clock source. other oscillators may be chosen by programming these bit locations. the configuration bits allow users to choose between the various clock modes shown in ta bl e 9 - 1 . 9.2.1 clock switching mode configuration bits the fcksm<1:0> configuration bits (fosc<7:6>) are used to jointly configure device clock switching and the fail-safe clock monitor (fscm). clock switching is enabled only when fcksm1 is programmed ( 0 ). the fscm is enabled only when fcksm<1:0> are both programmed ( 00 ). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 117 pic24fj1024ga610/gb610 family table 9-1: configuration bit va lues for clock selection 9.3 control registers the operation of the oscillator is controlled by five special function registers: osccon clkdiv osctun oscdiv oscfdiv in addition, two registers are used to control the dco: dcocon dcotun the osccon register ( register 9-1 ) is the main con- trol register for the oscillator. it controls clock source switching and allows the monitoring of clock sources. osccon is protected by a write lock to prevent inadvertent clock switches. see section 9.4 clock switching operation for more information. the clkdiv register ( register 9-2 ) controls the features associated with doze mode, as well as the postscalers for the oscfdiv clock mode and the pll module. the osctun register ( register 9-3 ) allows the user to fine-tune the frc oscillator over a range of approxi- mately 1.5%. it also controls the frc self-tuning features described in section 9.5 frc active clock tuning . the oscdiv and oscfdiv registers provide control for the system oscillator frequency divider. 9.3.1 dco overview the dco (digitally controlled oscillator) is a low- power alternative to the frc. it can generate a wider selection of operating frequencies and can be trimmed to correct process variations if an exact frequency is required. however, the dco is not designed for use with usb applications and cannot meet usb timing restrictions. oscillator mode oscillator source poscmd<1:0> fnosc<2:0> notes oscillator with frequency division (oscfdiv) internal/external 11 111 1 , 2 , 3 digitally controlled oscillator (dco) internal 11 110 3 low-power rc oscillator (lprc) internal 11 101 3 secondary (timer1) oscillator (sosc) secondary 11 100 3 primary oscillator (xt) with pll module (xtpll) primary 01 011 primary oscillator (ec) with pll module (ecpll) primary 00 011 primary oscillator (hs) primary 10 010 primary oscillator (xt) primary 01 010 primary oscillator (ec) primary 00 010 fast rc oscillator with pll module (frcpll) internal 11 001 3 fast rc oscillator (frc) internal 11 000 3 note 1: the input oscillator to the oscfdiv clock mode is determined by the rcdiv<2:0> (clkdiv<10:8) bits. at por, the default value selects the frc module. 2: this is the default oscillator mode for an unprogrammed (erased) device. 3: osco pin function is determined by the osciofcn configuration bit. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 118 ? 2015 microchip technology inc. register 9-1: osccon: os cillator control register u-0 r-x ( 1 ) r-x ( 1 ) r-x ( 1 ) u-0 r/w-x ( 1 ) r/w-x ( 1 ) r/w-x ( 1 ) cosc2 cosc1 cosc0 nosc2 nosc1 nosc0 bit 15 bit 8 r/w-0 r/w-0 r-0 ( 3 ) u-0 r/co-0 r/w-0 r/w-0 r/w-0 clklock iolock ( 2 ) lock cf poscen soscen oswen bit 7 bit 0 legend: co = clearable only bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-12 cosc<2:0>: current oscillator selection bits ( 1 ) 111 = oscillator with frequency divider (oscfdiv) 110 = digitally controlled oscillator (dco) 101 = low-power rc oscillator (lprc) 100 = secondary oscillator (sosc) 011 = primary oscillator with pll module (xtpll, ecpll) 010 = primary oscillator (xt, hs, ec) 001 = fast rc oscillator with pll module (frcpll) 000 = fast rc oscillator (frc) bit 11 unimplemented: read as 0 bit 10-8 nosc<2:0>: new oscillator selection bits ( 1 ) 111 = oscillator with frequency divider (oscfdiv) 110 = digitally controlled oscillator (dco) 101 = low-power rc oscillator (lprc) 100 = secondary oscillator (sosc) 011 = primary oscillator with pll module (xtpll, ecpll) 010 = primary oscillator (xt, hs, ec) 001 = fast rc oscillator with pll module (frcpll) 000 = fast rc oscillator (frc) bit 7 clklock: clock selection lock enable bit if fscm is enabled (fcksm<1:0> = 00 ): 1 = clock and pll selections are locked 0 = clock and pll selections are not locked and may be modified by setting the oswen bit if fscm is disabled (fcksm<1:0> = 1x ) : clock and pll selections are never locked and may be modified by setting the oswen bit. bit 6 iolock: i/o lock enable bit ( 2 ) 1 = i/o lock is active 0 = i/o lock is not active bit 5 lock: pll lock status bit ( 3 ) 1 = pll module is in lock or pll module start-up timer is satisfied 0 = pll module is out of lock, pll start-up timer is running or pll is disabled bit 4 unimplemented: read as 0 note 1: reset values for these bits are determined by the fnoscx configuration bits. 2: the state of the iolock bit can only be changed once an unlocking sequence has been executed. in addition, if the iol1way configuration bit is 1 , once the iolock bit is set, it cannot be cleared. 3: this bit also resets to 0 during any valid clock switch or whenever a non-pll clock mode is selected. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 119 pic24fj1024ga610/gb610 family bit 3 cf: clock fail detect bit 1 = fscm has detected a clock failure 0 = no clock failure has been detected bit 2 poscen: primary oscillator sleep enable bit 1 = primary oscillator continues to operate during sleep mode 0 = primary oscillator is disabled during sleep mode bit 1 soscen: 32 khz secondary oscillator (sosc) enable bit 1 = enables secondary oscillator 0 = disables secondary oscillator bit 0 oswen: oscillator switch enable bit 1 = initiates an oscillator switch to a clock source specified by the nosc<2:0> bits 0 = oscillator switch is complete register 9-1: osccon: oscillato r control register (continued) note 1: reset values for these bits are determined by the fnoscx configuration bits. 2: the state of the iolock bit can only be changed once an unlocking sequence has been executed. in addition, if the iol1way configuration bit is 1 , once the iolock bit is set, it cannot be cleared. 3: this bit also resets to 0 during any valid clock switch or whenever a non-pll clock mode is selected. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 120 ? 2015 microchip technology inc. register 9-2: clkdiv: clock divider register r/w-0 r/w-0 r/w-1 r/w-1 r/w-0 r/w-0 r/w-0 r/w-0 roi doze2 doze1 doze0 dozen ( 1 ) rcdiv2 rcdiv1 rcdiv0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 u-0 cpdiv1 cpdiv0 pllen bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 roi: recover on interrupt bit 1 = interrupts clear the dozen bit and reset the cpu peripheral clock ratio to 1:1 0 = interrupts have no effect on the dozen bit bit 14-12 doze<2:0>: cpu peripheral clock ratio select bits 111 = 1:128 110 = 1:64 101 = 1:32 100 = 1:16 011 = 1:8 (default) 010 = 1:4 001 = 1:2 000 = 1:1 bit 11 dozen: doze enable bit ( 1 ) 1 = doze<2:0> bits specify the cpu peripheral clock ratio 0 = cpu peripheral clock ratio is set to 1:1 bit 10-8 rcdiv<2:0>: system frequency divider clock source select bits 000 = fast rc oscillator (frc) 001 = fast rc oscillator (frc) with pll module (frcpll) 010 = primary oscillator (xt, hs, ec) 011 = primary oscillator (xt, hs, ec) with pll module (xtpll, hspll, ecpll) 100 = secondary oscillator (sosc) 101 = low-power rc oscillator (lprc) 110 = digitally controlled oscillator (dco) 111 = reserved; do not use bit 7-6 cpdiv<1:0>: system clock select bits (postscaler select from 96 mhz pll, 32 mhz clock branch) 11 = 4 mhz (divide-by-8) ( 2 ) 10 = 8 mhz (divide-by-4) ( 2 ) 01 = 16 mhz (divide-by-2) 00 = 32 mhz (divide-by-1) bit 5 pllen: usb pll enable bit 1 = pll is always active 0 = pll is only active when a pll oscillator mode is selected (osccon<14:12> = 011 or 001 ) bit 4-0 unimplemented: read as 0 note 1: this bit is automatically cleared when the roi bit is set and an interrupt occurs. 2: this setting is not allowed while the usb module is enabled. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 121 pic24fj1024ga610/gb610 family register 9-3: osctun: frc oscillator tune register r/w-0 u-0 r/w-0 r/w-1 r-0 r/w-0 r-0 r/w-0 sten s t s i d ls t s r c ( 1 ) stlock stlpol stor storpol bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 tun5 ( 2 ) tun4 ( 2 ) tun3 ( 2 ) tun2 ( 2 ) tun1 ( 2 ) tun0 ( 2 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 sten: frc self-tune enable bit 1 = frc self-tuning is enabled; tunx bits are controlled by hardware 0 = frc self-tuning is disabled; application may optionally control the tunx bits bit 14 unimplemented: read as 0 bit 13 stsidl: frc self-tune stop in idle bit 1 = self-tuning stops during idle mode 0 = self-tuning continues during idle mode bit 12 stsrc: frc self-tune reference clock source bit ( 1 ) 1 = frc is tuned to approximately match the usb host clock tolerance 0 = frc is tuned to approximately match the 32.768 khz sosc tolerance bit 11 stlock: frc self-tune lock status bit 1 = frc accuracy is currently within 0.2% of the stsrc reference accuracy 0 = frc accuracy may not be within 0.2% of the stsrc reference accuracy bit 10 stlpol: frc self-tune lock interrupt polarity bit 1 = a self-tune lock interrupt is generated when stlock is 0 0 = a self-tune lock interrupt is generated when stlock is 1 bit 9 stor: frc self-tune out of range status bit 1 = stsrc reference clock error is beyond the range of tun<5:0>; no tuning is performed 0 = stsrc reference clock is within the tunable range; tuning is performed bit 8 storpol: frc self-tune out of range interrupt polarity bit 1 = a self-tune out of range interrupt is generated when stor is 0 0 = a self-tune out of range interrupt is generated when stor is 1 bit 7-6 unimplemented: read as 0 bit 5-0 tun<5:0>: frc oscillator tuning bits ( 2 ) 011111 = maximum frequency deviation 011110 = ? ? ? 000001 = 000000 = center frequency, oscillator is running at factory calibrated frequency 111111 = ? ? ? 100001 = 100000 = minimum frequency deviation note 1: use of either clock tuning reference source has specific application requirements. see section 9.5 frc active clock tuning for details. 2: these bits are read-only when sten = 1 . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 122 ? 2015 microchip technology inc. register 9-4: dcotun: digitally co ntrolled oscillator tune register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 dcotun<5:0> ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as 0 bit 5-0 dcotun<5:0>: dco tuning bits ( 1 ) 011111 = maximum frequency (+4.65% adjustment) 011110 = 000001 = increase frequency by a single step (+0.15% adjustment) 000000 = center frequency, oscillator is running at calibrated frequency 111111 = decrease frequency by a single step (-0.15% adjustment) 100001 = 100000 = minimum frequency (-4.80% adjustment) note 1: frequency step-size will be greater for 15 mhz and 30 mhz options (9.2% adjustment range). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 123 pic24fj1024ga610/gb610 family register 9-5: dcocon: digitally co ntrolled oscillator enable register u-0 u-0 r/w-0 u-0 r/w-0 r/w-1 r/w-1 r/w-1 dcoen dcofsel3 dcofsel2 dcofsel1 dcofsel0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13 dcoen: dco enable bit 1 = dco continues to operate during sleep mode 0 = dco is inactive during sleep mode bit 12 unimplemented: read as 0 bit 11-8 dcofsel<3:0>: dco frequency select bits 0000 = 1 mhz 0001 = 2 mhz 0010 = 3 mhz 0011 = 4 mhz 0100 = 5 mhz 0101 = 6 mhz 0110 = 7 mhz 0111 = 8 mhz (most accurate oscillator setting) 1000 = reserved; do not use 1001 = reserved; do not use 1010 = reserved; do not use 1011 = reserved; do not use 1100 = reserved; do not use 1101 = reserved; do not use 1110 = 15 mhz 1111 = 30 mhz bit 7-0 unimplemented: read as 0 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 124 ? 2015 microchip technology inc. register 9-6: oscdiv: oscillator divisor register u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 div<14:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-1 div<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-0 div<14:0>: reference clock divider bits specifies the 1/2 period of the reference clock in the source clocks (ex: period of ref_clk_output = [reference source * 2] * div<14:0>). 111111111111111 = oscillator frequency divided by 65,534 (32,767 * 2) 111111111111110 = oscillator frequency divided by 65,532 (32,766 * 2) 000000000000011 = oscillator frequency divided by 6 (3 * 2) 000000000000010 = oscillator frequency divided by 4 (2 * 2) 000000000000001 = oscillator frequency divided by 2 (1 * 2) (default) 000000000000000 = oscillator frequency is unchanged (no divider) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 125 pic24fj1024ga610/gb610 family register 9-7: oscfdiv: oscilla tor fractional divisor register ( 1 ) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 trim<0:7> bit 15 bit 8 r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 trim8 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-7 trim<0:8>: trim bits provides fractional additive to the div<14:0> value for the 1/2 period of the oscillator clock. 0000_0000_0 = 0/512 (0.0) divisor added to divx value 0000_0000_1 = 1/512 (0.001953125) divisor added to divx value 0000_0001_0 = 2/512 (0.00390625) divisor added to divx value 100000000 = 256/512 (0.5000) divisor added to divx value 1111_1111_0 = 510/512 (0.99609375) divisor added to divx value 1111_1111_1 = 511/512 (0.998046875) divisor added to divx value bit 6-0 unimplemented: read as 0 note 1: trimx values greater than zero are only valid when divx values are greater than zero. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 126 ? 2015 microchip technology inc. 9.4 clock switching operation with few limitations, applications are free to switch between any of the five clock sources (posc, sosc, frc, dco and lprc) under software control and at any time. to limit the possible side effects that could result from this flexibility, pic24f devices have a safeguard lock built into the switching process. 9.4.1 enabling clock switching to enable clock switching, the fcksm1 configuration bit in fosc must be programmed to 0 . (refer to section 30.1 configuration bits for further details.) if the fcksm1 configuration bit is unprogrammed ( 1 ), the clock switching function and fail-safe clock monitor function are disabled; this is the default setting. the noscx control bits (osccon<10:8>) do not control the clock selection when clock switching is disabled. however, the cosc<2:0> bits (osccon<14:12>) will reflect the clock source selected by the fnoscx configuration bits. the oswen control bit (osccon<0>) has no effect when clock switching is disabled; it is held at 0 at all times. 9.4.2 oscillator switching sequence at a minimum, performing a clock switch requires this basic sequence: 1. if desired, read the coscx bits (osccon<14:12>) to determine the current oscillator source. 2. perform the unlock sequence to allow a write to the osccon register high byte. 3. write the appropriate value to the noscx bits (osccon<10:8>) for the new oscillator source. 4. perform the unlock sequence to allow a write to the osccon register low byte. 5. set the oswen bit to initiate the oscillator switch. once the basic sequence is completed, the system clock hardware responds automatically as follows: 1. the clock switching hardware compares the coscx bits with the new value of the noscx bits. if they are the same, then the clock switch is a redundant operation. in this case, the oswen bit is cleared automatically and the clock switch is aborted. 2. if a valid clock switch has been initiated, the lock (osccon<5>) and cf (osccon<3>) bits are cleared. 3. the new oscillator is turned on by the hardware if it is not currently running. if a crystal oscillator must be turned on, the hardware will wait until the ost expires. if the new source is using the pll, then the hardware waits until a pll lock is detected (lock = 1 ). 4. the hardware waits for 10 clock cycles from the new clock source and then performs the clock switch. 5. the hardware clears the oswen bit to indicate a successful clock transition. in addition, the noscx bit values are transferred to the coscx bits. 6. the old clock source is turned off at this time, with the exception of lprc (if wdt or fscm is enabled) or sosc (if soscen remains set). note: the primary oscillator mode has three different submodes (xt, hs and ec), which are determined by the poscmdx configuration bits. while an application can switch to and from primary oscillator mode in software, it cannot switch between the different primary submodes without reprogramming the device. note 1: the processor will continue to execute code throughout the clock switching sequence. timing-sensitive code should not be executed during this time. 2: direct clock switches between any primary oscillator mode with pll and frcpll mode are not permitted. this applies to clock switches in either direc- tion. in these instances, the application must switch to frc mode as a transi- tional clock source between the two pll modes. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 127 pic24fj1024ga610/gb610 family a recommended code sequence for a clock switch includes the following: 1. disable interrupts during the osccon register unlock and write sequence. 2. execute the unlock sequence for the osccon high byte by writing 78h and 9ah to osccon<15:8> in two back-to-back instructions. 3. write the new oscillator source to the noscx bits in the instruction immediately following the unlock sequence. 4. execute the unlock sequence for the osccon low byte by writing 46h and 57h to osccon<7:0> in two back-to-back instructions. 5. set the oswen bit in the instruction immediately following the unlock sequence. 6. continue to execute code that is not clock-sensitive (optional). 7. invoke an appropriate amount of software delay (cycle counting) to allow the selected oscillator and/or pll to start and stabilize. 8. check to see if oswen is 0 . if it is, the switch was successful. if oswen is still set, then check the lock bit to determine the cause of the failure. the core sequence for unlocking the osccon register and initiating a clock switch is shown in example 9-1 . example 9-1: basic code sequence for clock switching 9.5 frc active clock tuning pic24fj1024ga610/gb610 family devices include an automatic mechanism to calibrate the frc during run time. this system uses active clock tuning from a source of known accuracy to maintain the frc within a very narrow margin of its nominal 8 mhz frequency. this allows for a frequency accuracy that is well within the requirements of the usb 2.0 specification regarding full-speed usb devices. the self-tune system is controlled by the bits in the upper half of the osctun register. setting the sten bit (osctun<15>) enables the self-tuning feature, allow- ing the hardware to calibrate to a source selected by the stsrc bit (osctun<12>). when stsrc = 1 , the system uses the start-of-frame (sof) packets from an external usb host for its source. when stsrc = 0 , the system uses the crystal-controlled sosc for its calibra- tion source. regardless of the source, the system uses the tun<5:0> bits (osctun<5:0>) to change the frc oscillators frequency. frequency monitoring and adjustment is dynamic, occurring continuously during run time. while the system is active, the tunx bits cannot be written to by software. the self-tune system can generate a hardware interrupt, fstif. the interrupt can result from a drift of the frc from the reference, by greater than 0.2% in either direc- tion, or whenever the frequency deviation is beyond the ability of the tunx bits to correct (i.e., greater than 1.5%). the stlock and stor status bits (osctun<11,9>) are used to indicate these conditions. the stlpol and storpol bits (osctun<10,8>) configure the fstif interrupt to occur in the presence or the absence of the conditions. it is the users respon- sibility to monitor both the stlock and stor bits to determine the exact cause of the interrupt. ;place the new oscillator selection in w0 ;oscconh (high byte) unlock sequence mov #oscconh, w1 mov #0x78, w2 mov #0x9a, w3 mov.b w2, [w1] mov.b w3, [w1] ;set new oscillator selection mov.b wreg, oscconh ;oscconl (low byte) unlock sequence mov #oscconl, w1 mov #0x46, w2 mov #0x57, w3 mov.b w2, [w1] mov.b w3, [w1] ;start oscillator switch operation bset osccon, #0 note: the self-tune feature maintains sufficient accuracy for operation in usb device mode. for applications that function as a usb host, a high-accuracy clock source (0.05%) is still required. note: to use the usb as a reference clock tuning source (stsrc = 1 ), the microcontroller must be configured for usb device opera- tion and connected to a non-suspended usb host or hub port. if the sosc is to be used as the reference clock tuning source (stsrc = 0 ), the sosc must also be enabled for clock tuning to occur. note: the stlpol and storpol bits should be ignored when the self-tune system is disabled (sten = 0 ). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 128 ? 2015 microchip technology inc. 9.6 oscillator modes and usb operation the pll block can generate a wide range of clocks used for both parts with usb functionality (pic24fj1024gb610 family) and non-usb functionality (pic24fj1024ga610 family). all of the available pll modes are available for both families whether or nor usb is enabled or present. when used in a usb application, the 48 mhz internal clock must be running at all times which requires the vco of the pll to run at 96 mhz. this, in turn, forces the system clock (that drives the cpu and peripherals) to route the 96 mhz through a fixed divide-by-3 block (generating 32 mhz) and then through a selection of four fixed divisors (postscaler). the postscaler output becomes the system clock. the input to the pll vco must be 4 mhz when used in a usb application, which restricts the frequency input sources to be used with a small set of fixed frequency dividers (see figure 9-2 ). for example, if a 12 mhz crystal is used, the pllmode<3:0> configu- ration bits must be set for divide-by-3 to generate the required 4 mhz. a popular baud rate crystal is 11.0592 mhz, but this value cannot be used for usb operation as there are no divisors available to generate 4 mhz exactly. see tab l e 9 - 3 for the possible combina- tions of input clock and pllmodex bit settings for usb operation. non-usb operation allows the input frequency of the pll vco not to be restricted to 4 mhz with a fixed 24x multiplier ratio. the multiplier ratios can be selected as 4x, 6x or 8x and there is no clock prescaler. the postscaler (cpdiv<1:0>) is available and can be used to reduce the system clock to meet the 32 mhz maximum specification. note that the minimum input frequency to the vco is 2 mhz, but the range is 2 mhz to 8 mhz. therefore, it is possible to select a multiplier ratio that exceeds the 32 mhz maximum specification for the system clock. this allows the system clock to be any frequency between 8 mhz (2 mhz input clock with 4x multiplier ratio) and 32 mhz (4 mhz input clock with 8x multiplier ratio). for example, a common crystal frequency is 3.58 mhz (color burst) and this can be used with the 6x multiplier to generate a system clock of 21.48 mhz. the vco frequency becomes the system clock. the pll block is shown in figure 9-2 . in this system, the input from the primary oscillator is divided down by a pll prescaler to generate a 4 mhz output. this is used to drive an on-chip, 96 mhz pll frequency multiplier to drive the two clock branches. one branch uses a fixed, divide-by-2 frequency divider to generate the 48 mhz usb clock. the other branch uses a fixed, divide-by-3 frequency divider and configurable pll prescaler/ divider to generate a range of system clock frequencies. the cpdiv<1:0> bits select the system clock speed; available clock options are listed in table 9-2 . the usb pll prescaler does not automatically sense the incoming oscillator frequency. the user must man- ually configure the pll divider to generate the required 4 mhz output using the pllmode<3:0> configuration bits. this limits the choices for primary oscillator frequency to a total of 8 possibilities, as shown in table 9-3 . table 9-2: system clock options during usb operation table 9-3: valid primary oscillator configurations for usb operations ( 1 ) note 1: the maximum operating frequency of the system clock is 32 mhz. it is up to the user to select the proper multiplier ratio with the selected clock source frequency. exceeding a system clock of 32 mhz may permanently damage the part mcu clock division (cpdiv<1:0>) microcontroller clock frequency none ( 00 )3 2 m h z ? 2 ( 01 )1 6 m h z ? 4 ( 10 ) ( 1 ) 8mhz ? 8 ( 11 ) ( 1 ) 4mhz note 1: system clock frequencies below 16 mhz are too slow to allow usb operation. the usb module must be disabled to use this option. see section 9.6.1 considerations for usb operation . input oscillator frequency clock mode pll mode (pllmode<3:0>) 48 mhz ecpll ? 12 ( 0111 ) 32 mhz hspll, ecpll ? 8 ( 0110 ) 24 mhz hspll, ecpll ? 6 ( 0101 ) 20 mhz hspll, ecpll ? 5 ( 0100 ) 16 mhz hspll, ecpll ? 4 ( 0011 ) 12 mhz hspll, ecpll ? 3 ( 0010 ) 8 mhz ecpll, xtpll, frcpll ( 2 ) ? 2 ( 0001 ) 4 mhz ecpll, xtpll, frcpll ( 2 ) ? 1 ( 0000 ) note 1: usb operation restricts the vco input frequency to be 4 mhz. 2: this requires the use of the frc self-tune feature to maintain the required clock accuracy. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 129 pic24fj1024ga610/gb610 family figure 9-2: pll block pll 96 mhz pll prescaler 4 mhz cpu divider 48 mhz clock for usb module pll output for system clock cpdiv<1:0> pllmode<3:0> (2) input from posc input from frc (note 1) (4 mhz or 8 mhz for 32 mhz 0111 0110 0101 0100 0011 0010 0001 0000 ? 12 ? 8 ? 8 ? 6 ? 5 ? 4 ? 3 ? 2 ? 1 ? 4 ? 2 ? 1 00 01 10 11 note 1: this mux is controlled by the cosc<2:0> bits w hen running from the pll or the nosc<2:0> bits when preparing to switch to the pll. 2: the pllmode<3:0> bits are in the configurati on area. see the foscsel configuration register ( register 30-6 ) for more information. usb operation) 1100 1101 1110 x8 x6 x4 ? 2 ? 3 8 mhz-32 mhz 2 mhz- 8 mhz usb non-usb downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 130 ? 2015 microchip technology inc. 9.6.1 considerations for usb operation when using the usb on-the-go module in pic24fj1024ga610/gb610 devices, users must always observe these rules in configuring the system clock: the system clock frequency must be 16 mhz or 32 mhz. system clock frequencies below 16 mhz are not allowed for usb module operation. the oscillator modes listed in table 9-3 are the only oscillator configurations that permit usb operation. there is no provision to provide a separate external clock source to the usb module. for usb operation, the selected clock source (ec, hs or xt) must meet the usb clock tolerance requirements. when the frcpll oscillator mode is used for usb applications, the frc self-tune system should be used as well. while the frc is accurate, the only two ways to ensure the level of accuracy, required by the usb 2.0 specification throughout the appli- cations operating range, are either the self-tune system or manually changing the tun<5:0> bits. the user must always ensure that the frc source is configured to provide a frequency of 4 mhz or 8 mhz (rcdiv<2:0> = 001 or 000 ) and that the usb pll prescaler is configured appropriately. all other oscillator modes are available; however, usb operation is not possible when these modes are selected. they may still be useful in cases where other power levels of operation are desirable and the usb module is not needed (e.g., the application is sleeping and waiting for a bus attachment). 9.7 reference clock output in addition to the clko output (f osc /2) available in certain oscillator modes, the device clock in the pic24fj1024ga610/gb610 family devices can also be configured to provide a reference clock output signal to a port pin. this feature is available in all oscillator configura- tions and allows the user to select a greater range of clock submultiples to drive external devices in the application. clko is enabled by configuration bit, osciofcn, and is independent of the refo reference clock. refo is mappable to any i/o pin that has mapped output capability. refer to table 11-4 for more information. this reference clock output is controlled by the refoconl, refoconh and refotriml registers. setting the roen bit (refoconl<15>) makes the clock signal available on the refo pin. the rodiv<14:0> bits (refoconh<14:0>) enable the selection of different clock divider options. the rotrim<0:8> bits (refotriml<7:15>) allow the user to provide a fractional addition to the rodivx value. the roswen bit (refoconl<9>) indicates that the clock divider has been successfully switched. in order to switch the divider or trim the refo frequency, the user should ensure that this bit reads as 0 . write the updated values to rotrimx and rodivx bits, set the roswen bit and then wait until it is cleared before assuming that the refo clock is valid. the rosel<3:0> bits (refoconl<3:0>) determine which clock source is used for the reference clock out- put. the roslp bit (refoconl<11>) determines if the reference source is available on refo when the device is in sleep mode. to use the reference clock output in sleep mode, both the roslp bit must be set and the clock selected by the roselx bits must be enabled for operation during sleep mode, if possible. clearing the roselx bits allows the reference output frequency to change as the system clock changes during any clock switches. the roout bit enables/disables the reference clock output on the refo pin. the roactive bit (refoconl<8>) indicates that the module is active; it can be cleared by disabling the module (setting roen to 0 ). the user must not change the reference clock source, or adjust the trim or divider when the roactive bit indicates that the module is active. to avoid glitches, the user should not disable the module until the roactive bit is 1 . the pllss configuration bit (fosc<4>), when cleared, can be used to generate a refo clock with the pll that is independent of the system clock. the pll cannot be used in the primary clock chain. for example, if the system clock is using the frc at 8 mhz, the pll can use the frc as the input and generate 32 mhz (4x pll mode) out of refo. the pllss configuration bit (fosc<4>), when cleared, can be used to generate a refo clock with the pll that is independent of the system clock. the pll cannot be used in the primary clock chain. for example, if the system clock is using frc at 8 mhz, the pll can use the frc as the input and generate 32 mhz (4x pll mode) out of refo. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 131 pic24fj1024ga610/gb610 family 9.8 secondary oscillator 9.8.1 basic sosc operation pic24fj1024ga610/gb610 family devices do not have to set the soscen bit to use the secondary oscillator. any module requiring the sosc (such as rtcc or timer1) will automatically turn on the sosc when the clock signal is needed. the sosc, however, has a long start-up time (as long as 1 second). to avoid delays for peripheral start-up, the sosc can be manually started using the soscen bit. to use the secondary oscillator, the soscsel bit (fosc<3>) must be set to 1 . programming the soscsel bit to 0 configures the sosc pins for digital mode, enabling digital i/o functionality on the pins. 9.8.2 crystal selection the 32.768 khz crystal used for the sosc must have the following specifications in order to properly start up and run at the correct frequency when in high-power mode: 12.5 pf loading capacitance 1.0 pf shunt capacitance a typical esr of 35k; 50k maximum in addition, the two external crystal loading capacitors should be in the range of 18-22 pf, which will be based on the pc board layout. the capacitors should be c0g, 5% tolerance and rated 25v or greater. the accuracy and duty cycle of the sosc can be measured on the refo pin, and is recommended to be in the range of 40-60% and accurate to 0.65 hz. 9.8.3 low-power sosc operation the secondary oscillator can operate in two distinct levels of power consumption based on device configu- ration. in low-power mode, the oscillator operates in a low drive strength, low-power state. by default, the oscillator uses a higher drive strength, and therefore, requires more power. low-power mode is selected by configuration bit, soschp (fdevopt1<3>). the lower drive strength of this mode makes the sosc more sensitive to noise and requires a longer start-up time. this mode can be used with lower load capaci- tance crystals (6 pf-9 pf) having higher esr ratings (50k-80k) to reduce sleep current in the rtcc. when low-power mode is used, care must be taken in the design and layout of the sosc circuit to ensure that the oscillator starts up and oscillates properly. pc board layout issues, stray capacitance and other factors will need to be carefully controlled in order for the crystal to operate. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 132 ? 2015 microchip technology inc. register 9-8: refoconl: reference oscilla tor control register low r/w-0 u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r-0 roen rosidl roout roslp roswen roactive bit 15 bit 8 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 rosel3 rosel2 rosel1 rosel0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 roen: reference oscillator enable bit 1 = reference oscillator module is enabled 0 = reference oscillator is disabled bit 14 unimplemented: read as 0 bit 13 rosidl: refo stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 roout: reference clock output enable bit 1 = reference clock is driven out on the refo pin 0 = reference clock is not driven out on the refo pin bit 11 roslp: reference oscillator output stop in sleep bit 1 = reference oscillator continues to run in sleep 0 = reference oscillator is disabled in sleep bit 10 unimplemented: read as 0 bit 9 roswen: reference clock rodivx/rotrimx switch enable bit 1 = switch clock divider; clock divider switching is currently in progress 0 = clock divider switch has been completed bit 8 roactive: reference clock request status bit 1 = reference clock is active (user should not change the refo settings) 0 = reference clock is inactive (user can update the refo settings) bit 7-4 unimplemented: read as 0 bit 3-0 rosel<3:0>: reference clock source select bits 1111 - 1001 = reserved 1000 = refi pin 0111 = reserved 0110 = pll (4/6/8x or 96 mhz) 0101 = sosc 0100 = lprc 0011 = frc 0010 = posc 0001 = peripheral clock 0000 = system clock downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 133 pic24fj1024ga610/gb610 family register 9-9: refoconh: reference oscilla tor control register high u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r o d i v < 1 4 : 8 > bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rodiv<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-0 rodiv<14:0>: reference clock divider bits specifies 1/2 period of the reference clock in the source clocks (ex: period of output = [reference source * 2] * rodiv<14:0>; this equation does not apply to rodiv<14:0> = 0 ). 111111111111111 = refo clock is the base clock frequency divided by 65,534 (32,767 * 2) 111111111111110 = refo clock is the base clock frequency divided by 65,532 (32,766 * 2) 000000000000011 = refo clock is the base clock frequency divided by 6 (3 * 2) 000000000000010 = refo clock is the base clock frequency divided by 4 (2 * 2) 000000000000001 = refo clock is the base clock frequency divided by 2 (1 * 2) 000000000000000 = refo clock is the same frequency as the base clock (no divider) downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 134 ? 2015 microchip technology inc. register 9-10: refotriml: reference osci llator trim register low r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rotrim<0:7> bit 15 bit 8 r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 rotrim8 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-7 rotrim<0:8>: refo trim bits these bits provide a fractional additive to the rodivx value for the 1/2 period of the refo clock. 000000000 = 0/512 (0.0 divisor added to the rodivx value) 000000001 = 1/512 (0.001953125 divisor added to the rodivx value) 000000010 = 2/512 (0.00390625 divisor added to the rodivx value) 100000000 = 256/512 (0.5000 divisor added to the rodivx value) 111111110 = 510/512 (0.99609375 divisor added to the rodivx value) 111111111 = 511/512 (0.998046875 divisor added to the rodivx value) bit 6-0 unimplemented: read as 0 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 135 pic24fj1024ga610/gb610 family 10.0 power-saving features the pic24fj1024ga610/gb610 family of devices provides the ability to manage power consumption by selectively managing clocking to the cpu and the peripherals. in general, a lower clock frequency and a reduction in the number of circuits being clocked con- stitutes lower consumed power. all pic24f devices manage power consumption in four different ways: clock frequency instruction-based sleep and idle modes software-controlled doze mode selective peripheral control in software combinations of these methods can be used to selectively tailor an applications power consumption, while still maintaining critical application features, such as timing-sensitive communications. 10.1 clock frequency and clock switching pic24f devices allow for a wide range of clock frequencies to be selected under application control. if the system clock configuratio n is not locked, users can choose low-power or high-precision oscillators by simply changing the nosc<2:0> bits. the process of changing a system clock during operation, as well as limitations to the process, are discussed in more detail in section 9.0 oscillator configuration . 10.2 instruction-based power-saving modes pic24f devices have two special power-saving modes that are entered through the execution of a special pwrsav instruction. sleep mode stops clock operation and halts all code execution; idle mode halts the cpu and code execution, but allows peripheral modules to continue operation. the assembly syntax of the pwrsav instruction is shown in example 10-1 . the xc16 c compiler offers built-in functions for the power-saving modes as follows: idle(); // places part in idle sleep(); // places part in sleep sleep and idle modes can be exited as a result of an enabled interrupt, wdt time-out or a device reset. when the device exits these modes, it is said to wake-up. 10.2.1 sleep mode sleep mode has these features: the system clock source is shut down. if an on-chip oscillator is used, it is turned off. the device current consumption will be reduced to a minimum provided that no i/o pin is sourcing current. the fail-safe clock monitor does not operate during sleep mode since the system clock source is disabled. the lprc clock will continue to run in sleep mode if the wdt is enabled. the wdt, if enabled, is automatically cleared prior to entering sleep mode. some device features or peripherals may continue to operate in sleep mode. this includes items, such as the input change notification (icn) on the i/o ports or peripherals that use an external clock input. any peripheral that requires the system clock source for its operation will be disabled in sleep mode. the device will wake-up from sleep mode on any of the these events: on any interrupt source that is individually enabled on any form of device reset on a wdt time-out on wake-up from sleep, the processor will restart with the same clock source that was active when sleep mode was entered. example 10-1: pwrsav instruction syntax note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive refer- ence source. for more information, refer to the dspic33/pic24 family reference manual , power-saving features (ds39698), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. note: sleep_mode and idle_mode are con- stants defined in the assembler include file for the selected device. pwrsav #sleep_mode ; put the device into sleep mode pwrsav #idle_mode ; put the device into idle mode downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 136 ? 2015 microchip technology inc. 10.2.2 idle mode idle mode has these features: the cpu will stop executing instructions. the wdt is automatically cleared. the system clock source remains active. by default, all peripheral modules continue to operate normally from the system clock source, but can also be selectively disabled (see section 10.4 selective peripheral module control ). if the wdt or fscm is enabled, the lprc will also remain active. the device will wake from idle mode on any of these events: any interrupt that is individually enabled. any device reset. a wdt time-out. on wake-up from idle, the clock is reapplied to the cpu and instruction execution begins immediately, starting with the instruction following the pwrsav instruction or the first instruction in the isr. 10.2.3 interrupts coincident with power save instructions any interrupt that coincides with the execution of a pwrsav instruction will be held off until entry into sleep or idle mode has completed. the device will then wake-up from sleep or idle mode. 10.2.4 low-voltage/retention regulator pic24fj1024ga610/gb610 family devices incorpo- rate a second on-chip voltage regulator, designed to provide power to select microcontroller features at 1.2v nominal. this regulator allows features, such as data ram and the wdt, to be maintained in power-saving modes where they would otherwise be inactive, or maintain them at a lower power than would otherwise be the case. retention sleep uses less power than standard sleep mode, but takes more time to recover and begin execu- tion. an additional 10-15 s (typical) is required to charge v cap from 1.2v to 1.8v and start to execute instructions when exiting retention sleep. the vregs bit allows the control of speed to exit from the sleep modes (regular and retention) at the cost of more power. the regulator band gaps are enabled, which increases the current but reduces time to recover from sleep by ~10 s. the low-voltage/retention regulator is only available when sleep mode is invoked. it is controlled by the lpcfg configuration bit (fpor<2>) and in firmware by the reten bit (rcon<12>). lpcfg must be programmed (= 0 ) and the reten bit must be set (= 1 ) for the regulator to be enabled. 10.2.5 summary of low-power sleep modes the reten bit and the vregs bit (rcon<8>) allow for four different sleep modes, which will vary by wake- up time and power consumption. refer to tab l e 1 0- 1 for a summary of these modes. specific information about the current consumption and wake times can be found in section 33.0 electrical characteristics . 10.3 doze mode generally, changing clock speed and invoking one of the power-saving modes are the preferred strategies for reducing power consumption. there may be circumstances, however, where this is not practical. for example, it may be necessary for an application to maintain uninterrupted synchronous communication, even while it is doing nothing else. reducing system clock speed may introduce communication errors, while using a power-saving mode may stop communications completely. doze mode is a simple and effective alternative method to reduce power consumption while the device is still executing code. in this mode, the system clock contin- ues to operate from the same source and at the same speed. peripheral modules continue to be clocked at the same speed while the cpu clock speed is reduced. synchronization between the two clock domains is maintained, allowing the peripherals to access the sfrs while the cpu executes code at a slower rate. doze mode is enabled by setting the dozen bit (clkdiv<11>). the ratio between peripheral and core clock speed is determined by the doze<2:0> bits (clkdiv<14:12>). there are eight possible configurations, from 1:1 to 1:256, with 1:1 being the default. it is also possible to use doze mode to selectively reduce power consumption in event driven applica- tions. this allows clock-sensitive functions, such as synchronous communications, to continue without interruption while the cpu idles, waiting for something to invoke an interrupt routine. enabling the automatic return to full-speed cpu operation on interrupts is enabled by setting the roi bit (clkdiv<15>). by default, interrupt events have no effect on doze mode operation. table 10-1: low-power sleep modes reten vregs mode relative power (1 = lowest) 00 sleep 3 01 fast wake-up 4 10 retention sleep 1 11 fast retention 2 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 137 pic24fj1024ga610/gb610 family 10.4 selective peripheral module control idle and doze modes allow users to substantially reduce power consumption by slowing or stopping the cpu clock. even so, peripheral modules still remain clocked, and thus, consume power. there may be cases where the application needs what these modes do not provide: the allocation of power resources to cpu processing with minimal power consumption from the peripherals. pic24f devices address this requirement by allowing peripheral modules to be selectively disabled, reducing or eliminating their power consumption. this can be done with two control bits: the peripheral enable bit, generically named, xxxen, located in the modules main control sfr. the peripheral module disable (pmd) bit, generically named, xxxmd, located in one of the pmd control registers. both bits have similar functions in enabling or disabling their associated module. setting the pmd bit for a module disables all clock sources to that module, reducing its power consumption to an absolute mini- mum. in this state, the control and status registers associated with the peripheral will also be disabled, so writes to those registers will have no effect and read values will be invalid. many peripheral modules have a corresponding pmd bit. in contrast, disabling a module by clearing its xxxen bit disables its functionality, but leaves its registers available to be read and written to. this reduces power consumption, but not by as much as setting the pmd bit does. most peripheral modules have an enable bit; exceptions include input capture, output compare and rtcc. to achieve more selective power savings, peripheral modules can also be selectively disabled when the device enters idle mode. this is done through the control bit of the generic name format, xxxidl. by default, all modules that can operate during idle mode will do so. using the disable on idle feature allows further reduction of power consumption during idle mode, enhancing power savings for extremely critical power applications. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 138 ? 2015 microchip technology inc. table 10-2: peripheral module disable register summary register bit 15 bit 14 bit 13 bit 12 bit 11 bit 10 bit 9 bit 8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 all resets pmd1 t5md t4md t3md t2md t1md i2c1md u2md u1md spi2md spi1md adcmd 0000 pmd2 ic6md ic5md ic4md ic3md ic2md ic1md oc6md oc5md oc4md oc3md oc2md oc1md 0000 pmd3 cmpmd rtccmd pmpmd crcmd u3md i2c3md i2c2md 0000 pmd4 u 4 m d refomd ctmumd lvdmd usbmd ( 1 ) 0000 pmd5 ccp7md ccp6md ccp5md ccp4md ccp3md ccp2md ccp1md 0000 pmd6 s p i 3 m d 0000 pmd7 dma1md dma0md 0000 pmd8 u6md u5md clc4md clc3md clc2md clc1md 0000 legend: = unimplemented, read as 0 . reset values are shown in hexadecimal. note 1: usb is not present on pic24fjxxxxga6xx devices. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 139 pic24fj1024ga610/gb610 family register 10-1: pmd1: peripheral module disable register 1 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 t5md t4md t3md t2md t1md bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 i2c1md u2md u1md spi2md spi1md adc1md bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 t5md: timer5 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 14 t4md: timer4 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 13 t3md: timer3 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 12 t2md: timer2 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 11 t1md: timer1 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 10-8 unimplemented: read as 0 bit 7 i2c1md: i2c1 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 6 u2md: uart2 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 5 u1md: uart1 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 4 spi2md: spi2 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 3 spi1md: spi1 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 2-1 unimplemented: read as 0 bit 0 adc1md: a/d converter module disable bit 1 = module is disabled 0 = module power and clock sources are enabled downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 140 ? 2015 microchip technology inc. register 10-2: pmd2: peripheral module disable register 2 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ic6md ic5md ic4md ic3md ic2md ic1md bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 oc6md oc5md oc4md oc3md oc2md oc1md bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13 ic6md: input capture 6 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 12 ic5md: input capture 5 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 11 ic4md: input capture 4 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 10 ic3md: input capture 3 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 9 ic2md: input capture 2 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 8 ic1md: input capture 1 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 7-6 unimplemented: read as 0 bit 5 oc6md: output capture 6 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 4 oc5md: output capture 5 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 3 oc4md: output capture 4 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 2 oc3md: output capture 3 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 1 oc2md: output capture 2 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 0 oc1md: output capture 1 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 141 pic24fj1024ga610/gb610 family register 10-3: pmd3: peripheral module disable register 3 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 cmpmd rtccmd pmpmd bit 15 bit 8 r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 u-0 crcmd u3md i2c3md i2c2md bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as 0 bit 10 cmpmd: triple comparator module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 9 rtccmd: rtcc module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 8 pmpmd: enhanced parallel master port disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 7 crcmd: crc module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 6-4 unimplemented: read as 0 bit 3 u3md: uart3 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 2 i2c3md: i2c3 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 1 i2c2md: i2c2 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 0 unimplemented: read as 0 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 142 ? 2015 microchip technology inc. register 10-4: pmd4: peripheral module disable register 4 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 u 4 m d refomd ctmumd lvdmd usbmd ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as 0 bit 5 u4md: uart4 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 4 unimplemented: read as 0 bit 3 refomd: reference output clock disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 2 ctmumd: ctmu module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 1 lvdmd: high/low-voltage detect module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 0 usbmd: usb on-the-go module disable bit ( 1 ) 1 = module is disabled 0 = module power and clock sources are enabled note 1: usb is not present on pic24fjxxxxga6xx devices. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 143 pic24fj1024ga610/gb610 family register 10-5: pmd5: peripheral module disable register 5 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ccp7md ccp6md ccp5md ccp4md ccp3md ccp2md ccp1md bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-7 unimplemented: read as 0 bit 6 ccp7md: sccp7 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 5 ccp6md: sccp6 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 4 ccp5md: sccp5 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 3 ccp4md: mccp4 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 2 ccp3md: mccp3 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 1 ccp2md: mccp2 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 0 ccp1md: mccp1 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 144 ? 2015 microchip technology inc. register 10-6: pmd6: peripheral module disable register 6 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 spi3md bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-1 unimplemented: read as 0 bit 0 spi3md: spi3 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled register 10-7: pmd7: peripheral module disable register 7 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 d m a 1 m dd m a 0 m d bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as 0 bit 5 dma1md: dma1 controller (channels 4 through 7) disable bit 1 = controller is disabled 0 = controller power and clock sources are enabled bit 4 dma0md: dma0 controller (channels 0 through 3) disable bit 1 = controller is disabled 0 = controller power and clock sources are enabled bit 3-0 unimplemented: read as 0 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 145 pic24fj1024ga610/gb610 family register 10-8: pmd8: peripheral module disable register 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 u6md u5md clc4md clc3md clc2md clc1md bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 u6md: uart6 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 6 u5md: uart5 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 5 clc4md: clc4 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 4 clc3md: clc3 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 3 clc2md: clc2 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 2 clc1md: clc1 module disable bit 1 = module is disabled 0 = module power and clock sources are enabled bit 1-0 unimplemented: read as 0 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 146 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 147 pic24fj1024ga610/gb610 family 11.0 i/o ports all of the device pins (except v dd , v ss , mclr and osci/clki) are shared between the peripherals and the parallel i/o (pio) ports. all i/o input ports feature schmitt trigger (st) inputs for improved noise immunity. 11.1 parallel i/o (pio) ports a parallel i/o port that shares a pin with a peripheral is, in general, subservient to the peripheral. the periph- erals output buffer data and control signals are provided to a pair of multiplexers. the multiplexers select whether the peripheral or the associated port has ownership of the output data and control signals of the i/o pin. the logic also prevents loop through, in which a ports digital output can drive the input of a peripheral that shares the same pin. figure 11-1 shows how ports are shared with other peripherals and the associated i/o pin to which they are connected. when a peripheral is enabled and the peripheral is actively driving an associated pin, the use of the pin as a general purpose output pin is disabled. the i/o pin may be read, but the output driver for the parallel port bit will be disabled. if a peripheral is enabled, but the peripheral is not actively driving a pin, that pin may be driven by a port. all port pins have three registers directly associated with their operation as digital i/os and one register associated with their operation as analog inputs. the data direction register (trisx) determines whether the pin is an input or an output. if the data direction bit is a 1 , then the pin is an input. all port pins are defined as inputs after a reset. reads from the output latch register (latx), read the latch; writes to the latch, write the latch. reads from the portx register, read the port pins; writes to the port pins, write the latch. any bit and its associated data and control registers that are not valid for a particular device will be disabled. that means the corresponding latx and trisx registers, and the port pin, will read as zeros. when a pin is shared with another peripheral or func- tion that is defined as an input only, it is regarded as a dedicated port because there is no other competing source of inputs. figure 11-1: block diagram of a typical shared port structure note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference manual , i/o ports with peripheral pin select (pps) (ds39711), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. q dck wr lat + tris latch i/o pin wr port data bus q dck data latch read port read tris 10 1 0 wr tris peripheral output data output enable peripheral input data i/o peripheral module peripheral output enable pio module output multiplexers output data input data peripheral module enable read lat downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 148 ? 2015 microchip technology inc. 11.1.1 i/o port write/read timing one instruction cycle is required between a port direction change or port write operation and a read operation of the same port. typically, this instruction would be a nop . 11.1.2 open-drain configuration in addition to the portx, latx and trisx registers for data control, each port pin can also be individually configured for either a digital or open-drain output. this is controlled by the open-drain control register, odcx, associated with each port. setting any of the bits con- figures the corresponding pin to act as an open-drain output. the open-drain feature allows the generation of outputs higher than v dd (e.g., 5v) on any desired digital only pins by using external pull-up resistors. the maximum open-drain voltage allowed is the same as the maximum v ih specification. 11.2 configuring analog port pins (ansx) the ansx and trisx registers control the operation of the pins with analog function. each port pin with analog function is associated with one of the ansx bits (see register 11-1 through register 11-6 ), which decides if the pin function should be analog or digital. refer to table 11-1 for detailed behavior of the pin for different ansx and trisx bit settings. when reading the portx register, all pins configured as analog input channels will read as cleared (a low level). 11.2.1 analog input pins and voltage considerations the voltage tolerance of pins used as device inputs is dependent on the pins input function. most input pins are able to handle dc voltages of up to 5.5v, a level typ- ical for digital logic circuits. however, several pins can only tolerate voltages up to v dd . voltage excursions beyond v dd on these pins should always be avoided. table 11-2 summarizes the different voltage toler- ances. for more information, refer to section 33.0 electrical characteristics for more details. table 11-1: configuring analog/d igital function of an i/o pin pin function ansx setting trisx setting comments analog input 11 it is recommended to keep ansx = 1 . analog output 11 it is recommended to keep ansx = 1 . digital input 01 firmware must wait at least one instruction cycle after configuring a pin as a digital input before a valid input value can be read. digital output 00 make sure to disable the analog output function on the pin if any is present. table 11-2: input voltage levels for po rt or pin tolerated description input port or pin tolerated input description porta<15:14,5:0> 5.5v tolerates input levels above v dd ; useful for most standard logic. portc<3:1> portd<15:8,5:0> porte<8:5,3:0> portf<13:12,8:0> portg<15:12,1:0> porta<10:9,7:6> v dd only v dd input levels are tolerated. portb<15:0> portc<15:13,4> ( 1 ) portd<7:6> porte<9,4> portg<9:6,3:2> ( 2 ) note 1: portc<12> has osci pin function. 2: portg<3:2> have usb function on pic24fjxxxxgbxxx devices. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 149 pic24fj1024ga610/gb610 family register 11-1: ansa: porta anal og function selection register u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-1 u-0 ansa<10:9> ( 1 ) bit 15 bit 8 r/w-1 r/w-1 u-0 u-0 u-0 u-0 u-0 u-0 ansa<7:6> ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as 0 bit 10-9 ansa<10:9>: porta analog function selection bits ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 8 unimplemented: read as 0 bit 7-6 ansa<7:6>: porta analog function selection bits ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 5-0 unimplemented: read as 0 note 1: ansa<10:9,7> bits are not available on 64-pin devices. register 11-2: ansb: portb analog function selection register r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ansb<15:8> bit 15 bit 8 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ansb<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 ansb<15:0>: portb analog function selection bits 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 150 ? 2015 microchip technology inc. register 11-3: ansc: portc analog function selection register u-0 r/w-1 r/w-1 u-0 u-0 u-0 u-0 u-0 ansc<14:13> bit 15 bit 8 u-0 u-0 u-0 r/w-1 u-0 u-0 u-0 u-0 ansc4 ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-13 ansc<14:13>: portc analog function selection bits 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 12-5 unimplemented: read as 0 bit 4 ansc4: portc analog function selection bit ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 3-0 unimplemented: read as 0 note 1: ansc4 is not available on 64-pin devices. register 11-4: ansd: portd analog function selection register u-0 u-0 r-1 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-1 r/w-1 u-0 u-0 u-0 u-0 u-0 u-0 ansd<7:6> bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13 reserved: read as 1 bit 12-8 unimplemented: read as 0 bit 7-6 ansd<7:6>: portd analog function selection bits 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 5-0 unimplemented: read as 0 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 151 pic24fj1024ga610/gb610 family register 11-5: anse: porte analog function selection register u-0 u-0 u-0 u-0 u-0 u-0 r/w-1 u-0 anse9 ( 1 ) bit 15 bit 8 u-0 u-0 u-0 r/w-1 u-0 u-0 u-0 u-0 anse4 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-10 unimplemented: read as 0 bit 9 anse9: porte analog function selection bit ( 1 ) 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 8-5 unimplemented: read as 0 bit 4 anse4: porte analog function selection bit 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 3-0 unimplemented: read as 0 note 1: anse9 is not available on 64-pin devices. register 11-6: ansg: portg anal og function selection register u-0 u-0 u-0 u-0 u-0 u-0 r/w-1 r/w-1 ansg<9:8> bit 15 bit 8 r/w-1 r/w-1 u-0 u-0 u-0 u-0 u-0 u-0 ansg<7:6> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-10 unimplemented: read as 0 bit 9-6 ansg<9:6>: portg analog function selection bits 1 = pin is configured in analog mode; i/o port read is disabled 0 = pin is configured in digital mode; i/o port read is enabled bit 5-0 unimplemented: read as 0 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 152 ? 2015 microchip technology inc. 11.3 interrupt-on-change (ioc) the interrupt-on-change function of the i/o ports allows the pic24fj1024ga610/gb610 family of devices to generate interrupt requests to the processor in response to a change-of-state (cos) on selected input pins. this feature is capable of detecting input change-of-states, even in sleep mode when the clocks are disabled. interrupt-on-change functionality is enabled on a pin by setting the iocpx and/or iocnx register bit for that pin. for example, portc has register names, iocpc and iocnc, for these functions. setting a value of 1 in the iocpx register enables interrupts for low-to-high transitions, while setting a value of 1 in the iocnx register enables interrupts for high-to-low transitions. setting a value of 1 in both register bits will enable interrupts for either case (e.g., a pulse on the pin will generate two interrupts). in order for any ioc to be detected, the global ioc interrupt enable bit (iec1<3>) must be set. when an interrupt request is generated for a pin, the corresponding status flag (iocfx register bit) will be set, indicating that a change-of-state occurred on that pin. the iocfx register bit will remain set until cleared by writing a zero to it. when any iocfx flag bit in a given port is set, the corresponding iocpxf bit in the iocstat register will be set. this flag indicates that a change was detected on one of the bits on the given port. the iocpxf flag will be cleared when all iocfx<15:0> bits are cleared. multiple individual status flags can be cleared by writing a zero to one or more bits using a read-modify-write operation. if another edge is detected on a pin whose status bit is being cleared during the read-modify- write sequence, the associated change flag will still be set at the end of the read-modify-write sequence. the user should use the instruction sequence (or equivalent) shown in example 11-1 to clear the interrupt-on-change status registers. at the end of this sequence, the w0 register will contain a zero for each bit for which the port pin had a change detected. in this way, any indication of a pin changing will not be lost. due to the asynchronous and real-time nature of the interrupt-on-change, the value read on the port pins may not indicate the state of the port when the change was detected, as a second change can occur during the interval between clearing the flag and reading the port. it is up to the user code to handle this case if it is a possibility in their application. to keep this interval to a minimum, it is recommended that any code modifying the iocfx registers be run either in the interrupt handler or with interrupts disabled. each interrupt-on-change (ioc) pin has both a weak pull-up and a weak pull-down connected to it. the pull- ups act as a current source connected to the pin, while the pull-downs act as a current sink connected to the pin. these eliminate the need for external resistors when push button or keypad devices are connected. the pull-ups and pull-downs are separately enabled using the iocpux registers (for pull-ups) and the iocpdx registers (for pull-downs). each ioc pin has individual control bits for its pull-up and pull-down. set- ting a control bit enables the weak pull-up or pull-down for the corresponding pin. example 11-1: ioc status read/clear in assembly example 11-2: port read/write in assembly example 11-3: port read/write in c note: pull-ups and pull-downs on pins should always be disabled whenever the pin is configured as a digital output. mov 0xffff, w0 ; initial mask value 0xffff -> w0 xor iocfx, w0 ; w0 has '1' for each bit set in iocfx and iocfx ; iocfx & w0 ->iocfx mov 0xff00, w0 ; configure portb<15:8> as inputs mov w0, trisb ; and portb<7:0> as outputs nop ; delay 1 cycle btss portb, #13 ; next instruction trisb = 0xff00; // configure portb<15:8> as inputs and portb<7:0> as outputs nop(); // delay 1 cycle if (portbbits.rb13){ }; // next instruction downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 153 pic24fj1024ga610/gb610 family register 11-7: padcon: po rt configuration register r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 iocon bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 p m p t t l bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 iocon: interrupt-on-change enable bit 1 = interrupt-on-change functionality is enabled 0 = interrupt-on-change functionality is disabled bit 14-1 unimplemented: read as 0 bit 0 pmpttl: pmp port type bit 1 = ttl levels on pmp port pins 0 = schmitt triggers on pmp port pins downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 154 ? 2015 microchip technology inc. register 11-8: iocstat: interrupt-on-change status register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 r/hs/hc-0 r/hs/hc-0 r/hs/hc-0 r/hs/hc-0 r/hs/hc-0 r/hs/hc-0 r/hs/hc-0 iocpgf iocpff iocpef iocpdf iocpcf iocpbf iocpaf bit 7 bit 0 legend: hs = hardware settable bit hardware clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-7 unimplemented: read as 0 bit 6 iocpgf: interrupt-on-change portg flag bit 1 = a change was detected on an ioc-enabled pin on portg 0 = no change was detected or the user has cleared all detected changes bit 5 iocpff: interrupt-on-change portf flag bit 1 = a change was detected on an ioc-enabled pin on portf 0 = no change was detected or the user has cleared all detected changes bit 4 iocpef: interrupt-on-change porte flag bit 1 = a change was detected on an ioc-enabled pin on porte 0 = no change was detected or the user has cleared all detected changes bit 3 iocpdf: interrupt-on-change portd flag bit 1 = a change was detected on an ioc-enabled pin on portd 0 = no change was detected or the user has cleared all detected changes bit 2 iocpcf: interrupt-on-change portc flag bit 1 = a change was detected on an ioc-enabled pin on portc 0 = no change was detected or the user has cleared all detected changes bit 1 iocpbf: interrupt-on-change portb flag bit 1 = a change was detected on an ioc-enabled pin on portb 0 = no change was detected or the user has cleared all detected changes bit 0 iocpaf: interrupt-on-change porta flag bit 1 = a change was detected on an ioc-enabled pin on porta 0 = no change was detected, or the user has cleared all detected change downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 155 pic24fj1024ga610/gb610 family register 11-9: iocpx: interrupt-on -change positive edge x register ( 1 , 2 ) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 iocpx<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 iocpx<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 iocpx<15:0>: interrupt-on-change positive edge x enable bits 1 = interrupt-on-change is enabled on the iocx pin for a positive going edge; the associated status bit and interrupt flag will be set upon detecting an edge 0 = interrupt-on-change is disabled on the iocx pin for a positive going edge note 1: setting both iocpx and iocnx will enable the iocx pin for both edges, while clearing both registers will disable the functionality. 2: changing the value of this register while the module is enabled (iocon = 1 ) may cause a spurious ioc event. the corresponding interrupt must be ignored, cleared (using iocfx) or masked (within the interrupt controller), or this module must be enabled (iocon = 0 ) when changing this register. register 11-10: iocnx: interrupt-on-change negative edge x register ( 1 , 2 ) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 iocnx<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 iocnx<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 iocnx<15:0>: interrupt-on-change negative edge x enable bits 1 = interrupt-on-change is enabled on the iocx pin for a negative going edge; the associated status bit and interrupt flag will be set upon detecting an edge 0 = interrupt-on-change is disabled on the iocx pin for a negative going edge note 1: setting both iocpx and iocnx will enable the iocx pin for both edges, while clearing both registers will disable the functionality. 2: changing the value of this register while the module is enabled (iocon = 1 ) may cause a spurious ioc event. the corresponding interrupt must be ignored, cleared (using iocfx) or masked (within the interrupt controller), or this module must be enabled (iocon = 0 ) when changing this register. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 156 ? 2015 microchip technology inc. register 11-11: iocfx: interrupt-on-change flag x register ( 1 ) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 iocfx<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 iocfx<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 iocfx<15:0>: interrupt-on-change flag x bits 1 = an enabled change was detected on the associated pin; set when iocpx = 1 and a positive edge was detected on the iocx pin, or when iocnx = 1 and a negative edge was detected on the iocx pin 0 = no change was detected or the user cleared the detected change note 1: it is not possible to set the iocfx register bits with software writes (as this would require the addition of significant logic). to test ioc interrupts, it is recommended to enable the ioc functionality on one or more gpio pins and then use the corresponding latx register bit(s) to trigger an ioc interrupt. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 157 pic24fj1024ga610/gb610 family 11.4 peripheral pin select (pps) a major challenge in general purpose devices is provid- ing the largest possible set of peripheral features while minimizing the conflict of features on i/o pins. in an application that needs to use more than one peripheral multiplexed on a single pin, inconvenient work arounds in application code, or a complete redesign, may be the only option. the peripheral pin select (pps) feature provides an alternative to these choices by enabling the users peripheral set selection and its placement on a wide range of i/o pins. by increasing the pinout options available on a particular device, users can better tailor the microcontroller to their entire application, rather than trimming the application to fit the device. the peripheral pin select feature operates over a fixed subset of digital i/o pins. users may independently map the input and/or output of any one of many digital peripherals to any one of these i/o pins. pps is per- formed in software and generally does not require the device to be reprogrammed. hardware safeguards are included that prevent accidental or spurious changes to the peripheral mapping once it has been established. 11.4.1 available pins the pps feature is used with a range of up to 44 pins, depending on the particular device and its pin count. pins that support the peripheral pin select feature include the designation, rpn or rpin, in their full pin designation, where n is the remappable pin number. rp is used to designate pins that support both remap- pable input and output functions, while rpi indicates pins that support remappable input functions only. pic24fj1024ga610/gb610 family devices support a larger number of remappable input/output pins than remappable input only pins. in this device family, there are up to 44 remappable input/output pins, depending on the pin count of the particular device selected. these pins are numbered, rp0 through rp31, and rpi32 through rpi43. see ta bl e 1 - 1 for a summary of pinout options in each package offering. 11.4.2 available peripherals the peripherals managed by the pps are all digital only peripherals. these include general serial commu- nications (uart and spi), general purpose timer clock inputs, timer related peripherals (input capture and output compare) and external interrupt inputs. also included are the outputs of the comparator module, since these are discrete digital signals. pps is not available for these peripherals: i 2 c (input and output) input change notifications rtcc alarm output(s) epmp signals (input and output) analog (inputs and outputs) int0 a key difference between pin select and non-pin select peripherals is that pin select peripherals are not asso- ciated with a default i/o pin. the peripheral must always be assigned to a specific i/o pin before it can be used. in contrast, non-pin select peripherals are always available on a default pin, assuming that the peripheral is active and not conflicting with another peripheral. 11.4.2.1 peripheral pin select function priority pin-selectable peripheral outputs (e.g., output com- pare, uart transmit) will take priority over general purpose digital functions on a pin, such as epmp and port i/o. specialized digital outputs will take priority over pps outputs on the same pin. the pin diagrams list peripheral outputs in the order of priority. refer to them for priority concerns on a particular pin. unlike pic24f devices with fixed peripherals, pin- selectable peripheral inputs will never take ownership of a pin. the pins output buffer will be controlled by the trisx setting or by a fixed peripheral on the pin. if the pin is configured in digital mode, then the pps input will operate correctly. if an analog function is enabled on the pin, the pps input will be disabled. 11.4.3 controlling peripheral pin select pps features are controlled through two sets of special function registers (sfrs): one to map peripheral inputs and one to map outputs. because they are separately controlled, a particular peripherals input and output (if the peripheral has both) can be placed on any selectable function pin without constraint. the association of a peripheral to a peripheral-selectable pin is handled in two different ways, depending on if an input or an output is being mapped. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 158 ? 2015 microchip technology inc. 11.4.3.1 input mapping the inputs of the peripheral pin select options are mapped on the basis of the peripheral; that is, a control register associated with a peripheral dictates the pin it will be mapped to. the rpinrx registers are used to configure peripheral input mapping (see register 11-12 through register 11-35 ). each register contains one or two sets of 6-bit fields, with each set associated with one of the pin-selectable peripherals. programming a given peripherals bit field with an appropriate 6-bit value maps the rpn/rpin pin with that value to that peripheral. for any given device, the valid range of values for any of the bit fields corre- sponds to the maximum number of peripheral pin selections supported by the device. table 11-3: selectable input sources (maps input to function) ( 1 ) input name function name register function mapping bits output compare trigger 1 octrig1 rpinr0<5:0> octrig1r<5:0> external interrupt 1 int1 rpinr0<13:8> int1r<5:0> external interrupt 2 int2 rpinr1<5:0> int2r<5:0> external interrupt 3 int3 rpinr1<13:8> int3r<5:0> external interrupt 4 int4 rpinr2<5:0> int4r<5:0> output compare trigger 2 octrig2 rpinr2<13:8> octrig2r<5:0> timer2 external clock t2ck rpinr3<5:0> t2ckr<5:0> timer3 external clock t3ck rpinr3<13:8> t3ckr<5:0> timer4 external clock t4ck rpinr4<5:0> t4ckr<5:0> timer5 external clock t5ck rpinr4<13:8> t5ckr<5:0> input capture 1 ic1 rpinr7<5:0> ic1r<5:0> input capture 2 ic2 rpinr7<13:8> ic2r<5:0> input capture 3 ic3 rpinr8<5:0> ic3r<5:0> output compare fault a ocfa rpinr11<5:0> ocfar<5:0> output compare fault b ocfb rpinr11<13:8> ocfbr<5:0> ccp clock input a tckia rpinr12<5:0> tckiar<5:0> ccp clock input b tckib rpinr12<13:8> tckibr<5:0> uart3 receive u3rx rpinr17<13:8> u3rxr<5:0> uart1 receive u1rx rpinr18<5:0> u1rxr<5:0> uart1 clear-to-send u1cts rpinr18<13:8> u1ctsr<5:0> uart2 receive u2rx rpinr19<5:0> u2rxr<5:0> uart2 clear-to-send u2cts rpinr19<13:8> u2ctsr<5:0> spi1 data input sdi1 rpinr20<5:0> sdi1r<5:0> spi1 clock input sck1in rpinr20<13:8> sck1r<5:0> spi1 slave select input ss1in rpinr21<5:0> ss1r<5:0> uart3 clear-to-send u3cts rpinr21<13:8> u3ctsr<5:0> spi2 data input sdi2 rpinr22<5:0> sdi2r<5:0> spi2 clock input sck2in rpinr22<13:8> sck2r<5:0> spi2 slave select input ss2in rpinr23<5:0> ss2r<5:0> generic timer external clock txck rpinr23<13:8> txckr<5:0> clc input a clcina rpinr25<5:0> clcinar<5:0> clc input b clcinb rpinr25<13:8> clcinbr<5:0> uart4 receive u4rx rpinr27<5:0> u4rxr<5:0> uart4 clear-to-send u4cts rpinr27<13:8> u4ctsr<5:0> spi3 data input sdi3 rpinr28<5:0> sdi3r<5:0> spi3 clock input sck3in rpinr28<13:8> sck3r<5:0> spi3 slave select input ss3in rpinr29<5:0> ss3r<5:0> note 1: unless otherwise noted, all inputs use the schmitt trigger (st) input buffers. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 159 pic24fj1024ga610/gb610 family 11.4.3.2 output mapping in contrast to inputs, the outputs of the peripheral pin select options are mapped on the basis of the pin. in this case, a control register associated with a particular pin dictates the peripheral output to be mapped. the rporx registers are used to control output mapping. each register contains two 6-bit fields, with each field being associated with one rpn pin (see register 11-36 through register 11-51 ). the value of the bit field corresponds to one of the peripherals and that peripherals output is mapped to the pin (see table 11-4 ). because of the mapping technique, the list of peripherals for output mapping also includes a null value of 000000 . this permits any given pin to remain disconnected from the output of any of the pin-selectable peripherals. table 11-4: selectable output so urces (maps function to output) output function number function output name 0 none (pin disabled) 1 c1out comparator 1 output 2 c2out comparator 2 output 3u 1 t x u a r t 1 t r a n s m i t 4u 1 r t s uart1 request-to-send 5u 2 t x u a r t 2 t r a n s m i t 6u 2 r t s uart2 request-to-send 7 sdo1 spi1 data output 8 sck1out spi1 clock output 9 ss1out spi1 slave select output 10 sdo2 spi2 data output 11 sck2out spi2 clock output 12 ss2out spi2 slave select output 13 oc1 output compare 1 14 oc2 output compare 2 15 oc3 output compare 3 16 ocm4 ccp4 output compare 17 ocm5 ccp5 output compare 18 ocm6 ccp6 output compare 19 u3tx uart3 transmit 20 u3rts uart3 request-to-send 21 u4tx uart4 transmit 22 u4rts uart4 request-to-send 23 sdo3 spi3 data output 24 sck3out spi3 clock output 25 ss3out spi3 slave select output 26 c3out comparator 3 output 27 ocm7 ccp7 output compare 28 refo reference clock output 29 clc1out clc1 output 30 clc2out clc2 output 31 rtcc rtcc clock output downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 160 ? 2015 microchip technology inc. 11.4.3.3 mapping limitations the control schema of the peripheral pin select is extremely flexible. other than systematic blocks that prevent signal contention, caused by two physical pins being configured as the same functional input or two functional outputs configured as the same pin, there are no hardware enforced lockouts. the flexibility extends to the point of allowing a single input to drive multiple peripherals or a single functional output to drive multiple output pins. 11.4.3.4 mapping exceptions for pic24fj1024ga610/gb610 family devices although the pps registers theoretically allow for inputs to be remapped to up to 64 pins, or for outputs to be remapped from 32 pins, not all of these are implemented in all devices. for 100-pin or 121-pin variants of the pic24fj1024ga610/gb610 family devices, 32 remappable input/output pins are available and 12 remappable input pins are available. for 64-pin variants, 29 input/outputs and 1 input are available. the differences in available remappable pins are summarized in ta b l e 11 - 5 . when developing applications that use remappable pins, users should also keep these things in mind: for the rpinrx registers, bit combinations corre- sponding to an unimplemented pin for a particular device are treated as invalid; the corresponding module will not have an input mapped to it. for rporx registers, the bit fields corresponding to an unimplemented pin will also be unimplemented; writing to these fields will have no effect. 11.4.4 controlling configuration changes because peripheral remapping can be changed during run time, some restrictions on peripheral remapping are needed to prevent accidental configuration changes. pic24f devices include three features to prevent alterations to the peripheral map: control register lock sequence continuous state monitoring configuration bit remapping lock 11.4.4.1 control register lock under normal operation, writes to the rpinrx and rporx registers are not allowed. attempted writes will appear to execute normally, but the contents of the registers will remain unchanged. to change these reg- isters, they must be unlocked in hardware. the register lock is controlled by the iolock bit (osccon<6>). setting iolock prevents writes to the control registers; clearing iolock allows writes. to set or clear iolock, a specific command sequence must be executed: 1. write 46h to osccon<7:0>. 2. write 57h to osccon<7:0>. 3. clear (or set) iolock as a single operation. unlike the similar sequence with the oscillators lock bit, iolock remains in one state until changed. this allows all of the peripheral pin selects to be configured with a single unlock sequence, followed by an update to all control registers, then locked with a second lock sequence. 11.4.4.2 continuous state monitoring in addition to being protected from direct writes, the con- tents of the rpinrx and rporx registers are constantly monitored in hardware by shadow registers. if an unex- pected change in any of the registers occurs (such as cell disturbances caused by esd or other external events), a configuration mismatch reset will be triggered. 11.4.4.3 configuration bit pin select lock as an additional level of safety, the device can be configured to prevent more than one write session to the rpinrx and rporx registers. the iol1way (fosc<5>) configuration bit blocks the iolock bit from being cleared after it has been set once. if iolock remains set, the register unlock procedure will not execute and the peripheral pin select control reg- isters cannot be written to. the only way to clear the bit and re-enable peripheral remapping is to perform a device reset. in the default (unprogrammed) state, iol1way is set, restricting users to one write session. programming iol1way allows users unlimited access (with the proper use of the unlock sequence) to the peripheral pin select registers. table 11-5: remappable pin ex ceptions for pic24fj1024ga610/gb610 family devices device rpn pins (i/o) rpin pins total unimplemented total unimplemented pic24fjxxxgb606 28 rp5, rp15, rp30, rp31 1 all except rpi37 pic24fjxxxgx61x 32 12 pic24fjxxxga606 29 rp5, rp15, rp31 1 all except rpi37 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 161 pic24fj1024ga610/gb610 family 11.4.5 considerations for peripheral pin selection the ability to control peripheral pin selection intro- duces several considerations into application design that could be overlooked. this is particularly true for several common peripherals that are available only as remappable peripherals. the main consideration is that the peripheral pin selects are not available on default pins in the devices default (reset) state. since all rpinrx registers reset to 111111 and all rporx registers reset to 000000 , all peripheral pin select inputs are tied to v ss , and all peripheral pin select outputs are disconnected. this situation requires the user to initialize the device with the proper peripheral configuration before any other application code is executed. since the iolock bit resets in the unlocked state, it is not necessary to execute the unlock sequence after the device has come out of reset. for application safety, however, it is best to set iolock and lock the configuration after writing to the control registers. because the unlock sequence is timing-critical, it must be executed as an assembly language routine in the same manner as changes to the oscillator configura- tion. if the bulk of the application is written in c, or another high-level language, the unlock sequence should be performed by writing in-line assembly. choosing the configuration requires the review of all peripheral pin selects and their pin assignments, especially those that will not be used in the application. in all cases, unused pin-selectable peripherals should be disabled completely. unused peripherals should have their inputs assigned to an unused rpn/rpin pin function. i/o pins with unused rpn functions should be configured with the null peripheral output. the assignment of a peripheral to a particular pin does not automatically perform any other configuration of the pins i/o circuitry. in theory, this means adding a pin- selectable output to a pin may mean inadvertently driving an existing peripheral input when the output is driven. users must be familiar with the behavior of other fixed peripherals that share a remappable pin and know when to enable or disable them. to be safe, fixed digital peripherals that share the same pin should be disabled when not in use. along these lines, configuring a remappable pin for a specific peripheral does not automatically turn that feature on. the peripheral must be specifically config- ured for operation and enabled as if it were tied to a fixed pin. where this happens in the application code (immediately following a device reset and peripheral configuration or inside the main application routine) depends on the peripheral and its use in the application. a final consideration is that peripheral pin select func- tions neither override analog inputs nor reconfigure pins with analog functions for digital i/o. if a pin is configured as an analog input on a device reset, it must be explicitly reconfigured as a digital i/o when used with a peripheral pin select. example 11-4 shows a configuration for bidirectional communication with flow control using uart1. the following input and output functions are used: input functions: u1rx, u1cts output functions: u1tx, u1rts example 11-4: configuring uart1 input and output functions // unlock registers asm volatile ("mov #osccon, w1 \n" "mov #0x46, w2 \n" "mov #0x57, w3 \n" "mov.b w2, [w1] \n" "mov.b w3, [w1] \n" "bclr osccon, #6") ; // or use xc16 built-in macro: // __builtin_write_oscconl(osccon & 0xbf); // configure input functions ( table 11-3 ) // assign u1rx to pin rp0 rpinr18bits.u1rxr = 0; // assign u1cts to pin rp1 rpinr18bits.u1ctsr = 1; // configure output functions ( table 11-4 ) // assign u1tx to pin rp2 rpor1bits.rp2r = 3; // assign u1rts to pin rp3 rpor1bits.rp3r = 4; // lock registers asm volatile ("mov #osccon, w1 \n" "mov #0x46, w2 \n" "mov #0x57, w3 \n" "mov.b w2, [w1] \n" "mov.b w3, [w1] \n" "bset osccon, #6") ; // or use xc16 built-in macro: // __builtin_write_oscconl(osccon | 0x40); downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 162 ? 2015 microchip technology inc. 11.4.6 peripheral pin select registers the pic24fj1024ga610/gb610 family of devices implements a total of 40 registers for remappable peripheral configuration: input remappable peripheral registers (24) output remappable peripheral registers (16) note: input and output register values can only be changed if iolock (osccon<6>) = 0 . see section 11.4.4.1 control register lock for a specific command sequence. register 11-12: rpinr0: peripheral pin select input register 0 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 i n t 1 r 5i n t 1 r 4i n t 1 r 3i n t 1 r 2i n t 1 r 1i n t 1 r 0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 octrig1r5 octrig1r4 octrig1r3 octrig1r2 octrig1r1 octrig1r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 int1r<5:0>: assign external interrupt 1 (int1) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 octrig1r<5:0>: assign output compare trigger 1 to corresponding rpn or rpin pin bits register 11-13: rpinr1: peripheral pin select input register 1 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 i n t 3 r 5i n t 3 r 4i n t 3 r 3i n t 3 r 2i n t 3 r 1i n t 3 r 0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 i n t 2 r 5i n t 2 r 4i n t 2 r 3i n t 2 r 2i n t 2 r 1i n t 2 r 0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 int3r<5:0>: assign external interrupt 3 (int3) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 int2r<5:0>: assign external interrupt 2 (int2) to corresponding rpn or rpin pin bits downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 163 pic24fj1024ga610/gb610 family register 11-14: rpinr2: peripheral pin select input register 2 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 octrig2r5 octrig2r4 octrig2r3 octrig2r2 octrig2r1 octrig2r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 i n t 4 r 5i n t 4 r 4i n t 4 r 3i n t 4 r 2i n t 4 r 1i n t 4 r 0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 octrig2r<5:0>: assign output compare trigger 2 to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 int4r<5:0>: assign external interrupt 4 (int4) to corresponding rpn or rpin pin bits register 11-15: rpinr3: peripheral pin select input register 3 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 t 3 c k r 5t 3 c k r 4t 3 c k r 3t 3 c k r 2t 3 c k r 1t 3 c k r 0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 t 2 c k r 5t 2 c k r 4t 2 c k r 3t 2 c k r 2t 2 c k r 1t 2 c k r 0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 t3ckr<5:0> : assign timer3 clock to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 t2ckr<5:0>: assign timer2 clock to corresponding rpn or rpin pin bits downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 164 ? 2015 microchip technology inc. register 11-16: rpinr4: peripheral pin select input register 4 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 t 5 c k r 5t 5 c k r 4t 5 c k r 3t 5 c k r 2t 5 c k r 1t 5 c k r 0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 t 4 c k r 5t 4 c k r 4t 4 c k r 3t 4 c k r 2t 4 c k r 1t 4 c k r 0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 t5ckr<5:0>: assign timer5 clock to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 t4ckr<5:0>: assign timer4 clock to corresponding rpn or rpin pin bits register 11-17: rpinr5: peripheral pin select input register 5 u-0 u-0 r-1 r-1 r-1 r-1 r-1 r-1 bit 15 bit 8 u-0 u-0 r-1 r-1 r-1 r-1 r-1 r-1 bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 reserved : maintain as 1 bit 7-6 unimplemented: read as 0 bit 5-0 reserved : maintain as 1 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 165 pic24fj1024ga610/gb610 family register 11-18: rpinr6: peripheral pin select input register 6 u-0 u-0 r-1 r-1 r-1 r-1 r-1 r-1 bit 15 bit 8 u-0 u-0 r-1 r-1 r-1 r-1 r-1 r-1 bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 reserved : maintain as 1 bit 7-6 unimplemented: read as 0 bit 5-0 reserved : maintain as 1 register 11-19: rpinr7: peripheral pin select input register 7 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ic2r5 ic2r4 ic2r3 ic2r2 ic2r1 ic2r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ic1r5 ic1r4 ic1r3 ic1r2 ic1r1 ic1r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 ic2r<5:0>: assign input capture 2 (ic2) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 ic1r<5:0>: assign input capture 1 (ic1) to corresponding rpn or rpin pin bits downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 166 ? 2015 microchip technology inc. register 11-20: rpinr8: peripheral pin select input register 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ic3r5 ic3r4 ic3r3 ic3r2 ic3r1 ic3r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as 0 bit 5-0 ic3r<5:0>: assign input capture 3 (ic3) to corresponding rpn or rpin pin bits register 11-21: rpinr11: peripheral pin select input register 11 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ocfbr5 ocfbr4 ocfbr3 ocfbr2 ocfbr1 ocfbr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ocfar5 ocfar4 ocfar3 ocfar2 ocfar1 ocfar0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 ocfbr<5:0>: assign output compare fault b (ocfb) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 ocfar<5:0>: assign output compare fault a (ocfa) to corresponding rpn or rpin pin bits downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 167 pic24fj1024ga610/gb610 family register 11-22: rpinr12: peripheral pin select input register 12 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 tckibr5 tckibr4 tckibr3 tckibr2 tckibr1 tckibr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 tckiar5 tckiar4 tckiar3 tckiar2 tckiar1 tckiar0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 tckibr<5:0>: assign mccp/sccp clock input b to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 tckiar<5:0>: assign mccp/sccp clock input a to corresponding rpn or rpin pin bits register 11-23: rpinr14: peripheral pin select input register 14 u-0 u-0 r-1 r-1 r-1 r-1 r-1 r-1 bit 15 bit 8 u-0 u-0 r-1 r-1 r-1 r-1 r-1 r-1 bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 reserved : maintain as 1 bit 7-6 unimplemented: read as 0 bit 5-0 reserved : maintain as 1 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 168 ? 2015 microchip technology inc. register 11-24: rpinr15: peripheral pin select input register 15 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 r-1 r-1 r-1 r-1 r-1 r-1 bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as 0 bit 5-0 reserved : maintain as 1 register 11-25: rpinr17: peripheral pin select input register 17 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 u3rxr5 u3rxr4 u3rxr3 u3rxr2 u3rxr1 u3rxr0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 u3rxr<5:0>: assign uart3 receive (u3rx) to corresponding rpn or rpin pin bits bit 7-0 unimplemented: read as 0 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 169 pic24fj1024ga610/gb610 family register 11-26: rpinr18: peripheral pin select input register 18 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 u1ctsr5 u1ctsr4 u1ctsr3 u1ctsr2 u1ctsr1 u1ctsr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 u1rxr5 u1rxr4 u1rxr3 u1rxr2 u1rxr1 u1rxr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 u1ctsr<5:0>: assign uart1 clear-to-send (u1cts ) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 u1rxr<5:0>: assign uart1 receive (u1rx) to corresponding rpn or rpin pin bits register 11-27: rpinr19: peripheral pin select input register 19 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 u2ctsr5 u2ctsr4 u2ctsr3 u2ctsr2 u2ctsr1 u2ctsr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 u2rxr5 u2rxr4 u2rxr3 u2rxr2 u2rxr1 u2rxr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 u2ctsr<5:0>: assign uart2 clear-to-send (u2cts ) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 u2rxr<5:0>: assign uart2 receive (u2rx) to corresponding rpn or rpin pin bits downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 170 ? 2015 microchip technology inc. register 11-28: rpinr20: peripheral pin select input register 20 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 sck1r5 sck1r4 sck1r3 sck1r2 sck1r1 sck1r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 s d i 1 r 5s d i 1 r 4s d i 1 r 3s d i 1 r 2s d i 1 r 1s d i 1 r 0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 sck1r<5:0>: assign spi1 clock input (sck1in) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 sdi1r<5:0>: assign spi1 data input (sdi1) to corresponding rpn or rpin pin bits register 11-29: rpinr21: peripheral pin select input register 21 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 u3ctsr5 u3ctsr4 u3ctsr3 u3ctsr2 u3ctsr1 u3ctsr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ss1r5 ss1r4 ss1r3 ss1r2 ss1r1 ss1r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 u3ctsr<5:0>: assign uart3 clear-to-send (u3cts ) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 ss1r<5:0>: assign spi1 slave select input (ss1in) to corresponding rpn or rpin pin bits downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 171 pic24fj1024ga610/gb610 family register 11-30: rpinr22: peripheral pin select input register 22 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 sck2r5 sck2r4 sck2r3 sck2r2 sck2r1 sck2r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 s d i 2 r 5s d i 2 r 4s d i 2 r 3s d i 2 r 2s d i 2 r 1s d i 2 r 0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 sck2r<5:0>: assign spi2 clock input (sck2in) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 sdi2r<5:0>: assign spi2 data input (sdi2) to corresponding rpn or rpin pin bits register 11-31: rpinr23: peripheral pin select input register 23 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 txckr5 txckr4 txckr3 txckr2 txckr1 txckr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ss2r5 ss2r4 ss2r3 ss2r2 ss2r1 ss2r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 txckr<5:0>: assign general timer external input (txck) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 ss2r<5:0>: assign spi2 slave select input (ss2in) to corresponding rpn or rpin pin bits downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 172 ? 2015 microchip technology inc. register 11-32: rpinr25: peripheral pin select input register 25 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 clcinbr5 clcinbr4 clcinbr3 clcinbr2 clcinbr1 clcinbr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 clcinar5 clcinar4 clcinar3 clcinar2 clcinar1 clcinar0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 clcinbr<5:0>: assign clc input b to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 clcinar<5:0>: assign clc input a to corresponding rpn or rpin pin bits register 11-33: rpinr27: peripheral pin select input register 27 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 u4ctsr5 u4ctsr4 u4ctsr3 u4ctsr2 u4ctsr1 u4ctsr0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 u4rxr5 u4rxr4 u4rxr3 u 4rxr2 u4rxr1 u4rxr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 u4ctsr<5:0>: assign uart4 clear-to-send input (u4cts ) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 u4rxr<5:0>: assign uart4 receive input (u4rx) to corresponding rpn or rpin pin bits downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 173 pic24fj1024ga610/gb610 family register 11-34: rpinr28: peripheral pin select input register 28 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 sck3r5 sck3r4 sck3r3 sck3r2 sck3r1 sck3r0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 s d i 3 r 5s d i 3 r 4s d i 3 r 3s d i 3 r 2s d i 3 r 1s d i 3 r 0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 sck3r<5:0>: assign spi3 clock input (sck3in) to corresponding rpn or rpin pin bits bit 7-6 unimplemented: read as 0 bit 5-0 sdi3r<5:0>: assign spi3 data input (sdi3) to corresponding rpn or rpin pin bits register 11-35: rpinr29: peripheral pin select input register 29 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ss3r5 ss3r4 ss3r3 ss3r2 ss3r1 ss3r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as 0 bit 5-0 ss3r<5:0>: assign spi3 slave select input (ss3in) to corresponding rpn or rpin pin bits downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 174 ? 2015 microchip technology inc. register 11-36: rpor0: peripheral pin select output register 0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp1r5 rp1r4 rp1r3 rp1r2 rp1r1 rp1r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp0r5 rp0r4 rp0r3 rp0r2 rp0r1 rp0r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp1r<5:0>: rp1 output pin mapping bits peripheral output number n is assigned to pin, rp1 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp0r<5:0>: rp0 output pin mapping bits peripheral output number n is assigned to pin, rp0 (see table 11-4 for peripheral function numbers). register 11-37: rpor1: peripheral pin select output register 1 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp3r5 rp3r4 rp3r3 rp3r2 rp3r1 rp3r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp2r5 rp2r4 rp2r3 rp2r2 rp2r1 rp2r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp3r<5:0>: rp3 output pin mapping bits peripheral output number n is assigned to pin, rp3 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp2r<5:0>: rp2 output pin mapping bits peripheral output number n is assigned to pin, rp2 (see table 11-4 for peripheral function numbers). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 175 pic24fj1024ga610/gb610 family register 11-38: rpor2: peripheral pin select output register 2 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r p 5 r 5 ( 1 ) rp5r4 ( 1 ) rp5r3 ( 1 ) rp5r2 ( 1 ) rp5r1 ( 1 ) rp5r0 ( 1 ) bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp4r5 rp4r4 rp4r3 rp4r2 rp4r1 rp4r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp5r<5:0>: rp5 output pin mapping bits ( 1 ) peripheral output number n is assigned to pin, rp5 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp4r<5:0>: rp4 output pin mapping bits peripheral output number n is assigned to pin, rp4 (see table 11-4 for peripheral function numbers). note 1: this pin is not available on 64-pin devices. register 11-39: rpor3: peripheral pin select output register 3 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp7r5 rp7r4 rp7r3 rp7r2 rp7r1 rp7r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp6r5 rp6r4 rp6r3 rp6r2 rp6r1 rp6r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp7r<5:0>: rp7 output pin mapping bits peripheral output number n is assigned to pin, rp7 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp6r<5:0>: rp6 output pin mapping bits peripheral output number n is assigned to pin, rp6 (see table 11-4 for peripheral function numbers). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 176 ? 2015 microchip technology inc. register 11-40: rpor4: peripheral pin select output register 4 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp9r5 rp9r4 rp9r3 rp9r2 rp9r1 rp9r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp8r5 rp8r4 rp8r3 rp8r2 rp8r1 rp8r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp9r<5:0>: rp9 output pin mapping bits peripheral output number n is assigned to pin, rp9 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp8r<5:0>: rp8 output pin mapping bits peripheral output number n is assigned to pin, rp8 (see table 11-4 for peripheral function numbers). register 11-41: rpor5: peripheral pin select output register 5 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp11r5 rp11r4 rp11r3 rp11r2 rp11r1 rp11r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp10r5 rp10r4 rp10r3 rp10r2 rp10r1 rp10r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp11r<5:0>: rp11 output pin mapping bits peripheral output number n is assigned to pin, rp11 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp10r<5:0>: rp10 output pin mapping bits peripheral output number n is assigned to pin, rp10 (see table 11-4 for peripheral function numbers). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 177 pic24fj1024ga610/gb610 family register 11-42: rpor6: peripheral pin select output register 6 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp13r5 rp13r4 rp13r3 rp13r2 rp13r1 rp13r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp12r5 rp12r4 rp12r3 rp12r2 rp12r1 rp12r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp13r<5:0>: rp13 output pin mapping bits peripheral output number n is assigned to pin, rp13 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp12r<5:0>: rp12 output pin mapping bits peripheral output number n is assigned to pin, rp12 (see table 11-4 for peripheral function numbers). register 11-43: rpor7: peripheral pin select output register 7 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp15r5 ( 1 ) rp15r4 ( 1 ) rp15r3 ( 1 ) rp15r2 ( 1 ) rp15r1 ( 1 ) rp15r0 ( 1 ) bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp14r5 rp14r4 rp14r3 rp14r2 rp14r1 rp14r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp15r<5:0>: rp15 output pin mapping bits ( 1 ) peripheral output number n is assigned to pin, rp15 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp14r<5:0>: rp14 output pin mapping bits peripheral output number n is assigned to pin, rp14 (see table 11-4 for peripheral function numbers). note 1: this pin is not available on 64-pin devices. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 178 ? 2015 microchip technology inc. register 11-44: rpor8: peripheral pin select output register 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp17r5 rp17r4 rp17r3 rp17r2 rp17r1 rp17r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp16r5 rp16r4 rp16r3 rp16r2 rp16r1 rp16r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp17r<5:0>: rp17 output pin mapping bits peripheral output number n is assigned to pin, rp17 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp16r<5:0>: rp16 output pin mapping bits peripheral output number n is assigned to pin, rp16 (see table 11-4 for peripheral function numbers). register 11-45: rpor9: peripheral pin select output register 9 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp19r5 rp19r4 rp19r3 rp19r2 rp19r1 rp19r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp18r5 rp18r4 rp18r3 rp18r2 rp18r1 rp18r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp19r<5:0>: rp19 output pin mapping bits peripheral output number n is assigned to pin, rp19 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp18r<5:0>: rp18 output pin mapping bits peripheral output number n is assigned to pin, rp18 (see table 11-4 for peripheral function numbers). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 179 pic24fj1024ga610/gb610 family register 11-46: rpor10: peripheral pin select output register 10 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp21r5 rp21r4 rp21r3 rp21r2 rp21r1 rp21r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp20r5 rp20r4 rp20r3 rp20r2 rp20r1 rp20r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp21r<5:0>: rp21 output pin mapping bits peripheral output number n is assigned to pin, rp21 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp20r<5:0>: rp20 output pin mapping bits peripheral output number n is assigned to pin, rp20 (see table 11-4 for peripheral function numbers). register 11-47: rpor11: peripheral pin select output register 11 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp23r5 rp23r4 rp23r3 rp23r2 rp23r1 rp23r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp22r5 rp22r4 rp22r3 rp22r2 rp22r1 rp22r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp23r<5:0>: rp23 output pin mapping bits peripheral output number n is assigned to pin, rp23 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp22r<5:0>: rp22 output pin mapping bits peripheral output number n is assigned to pin, rp22 (see table 11-4 for peripheral function numbers). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 180 ? 2015 microchip technology inc. register 11-48: rpor12: peripheral pin select output register 12 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp25r5 rp25r4 rp25r3 rp25r2 rp25r1 rp25r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp24r5 rp24r4 rp24r3 rp24r2 rp24r1 rp24r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp25r<5:0>: rp25 output pin mapping bits peripheral output number n is assigned to pin, rp25 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp24r<5:0>: rp24 output pin mapping bits peripheral output number n is assigned to pin, rp24 (see table 11-4 for peripheral function numbers). register 11-49: rpor13: peripheral pin select output register 13 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp27r5 rp27r4 rp27r3 rp27r2 rp27r1 rp27r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp26r5 rp26r4 rp26r3 rp26r2 rp26r1 rp26r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp27r<5:0>: rp27 output pin mapping bits peripheral output number n is assigned to pin, rp27 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp26r<5:0>: rp26 output pin mapping bits peripheral output number n is assigned to pin, rp26 (see table 11-4 for peripheral function numbers). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 181 pic24fj1024ga610/gb610 family register 11-50: rpor14: peripheral pin select output register 14 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp29r5 rp29r4 rp29r3 rp29r2 rp29r1 rp29r0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp28r5 rp28r4 rp28r3 rp28r2 rp28r1 rp28r0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp29r<5:0>: rp29 output pin mapping bits peripheral output number n is assigned to pin, rp29 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp28r<5:0>: rp28 output pin mapping bits peripheral output number n is assigned to pin, rp28 (see table 11-4 for peripheral function numbers). register 11-51: rpor15: peripheral pin select output register 15 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp31r5 ( 1 ) rp31r4 ( 1 ) rp31r3 ( 1 ) rp31r2 ( 1 ) rp31r1 ( 1 ) rp31r0 ( 1 ) bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rp30r5 ( 2 ) rp30r4 ( 2 ) rp30r3 ( 2 ) rp30r2 ( 2 ) rp30r1 ( 2 ) rp30r0 ( 2 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rp31r<5:0>: rp31 output pin mapping bits ( 1 ) peripheral output number n is assigned to pin, rp31 (see table 11-4 for peripheral function numbers). bit 7-6 unimplemented: read as 0 bit 5-0 rp30r<5:0>: rp30 output pin mapping bits ( 2 ) peripheral output number n is assigned to pin, rp30 (see table 11-4 for peripheral function numbers). note 1: these pins are not available in 64-pin devices. 2: these pins are not available on the pic24fjxxxgb606. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 182 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 183 pic24fj1024ga610/gb610 family 12.0 timer1 the timer1 module is a 16-bit timer, which can serve as the time counter for the real-time clock (rtc) or operate as a free-running, interval timer/counter. timer1 can operate in three modes: 16-bit timer 16-bit synchronous counter 16-bit asynchronous counter timer1 also supports these features: timer gate operation selectable prescaler settings timer operation during cpu idle and sleep modes interrupt on 16-bit period register match or falling edge of external gate signal figure 12-1 presents a block diagram of the 16-bit timer module. to configure timer1 for operation: 1. clear the ton bit (= 0 ). 2. select the timer prescaler ratio using the tckps<1:0> bits. 3. set the clock and gating modes using the tcs, tecs<1:0> and tgate bits. 4. set or clear the tsync bit to configure synchronous or asynchronous operation. 5. load the timer period value into the pr1 register. 6. if interrupts are required, set the interrupt enable bit, t1ie. use the priority bits, t1ip<2:0>, to set the interrupt priority. 7. set the ton bit (= 1 ). figure 12-1: 16-bit timer1 module block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference manual , timers (ds39704), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. ton sync sosci sosco pr1 set t1if equal comparator reset soscen 1 0 tsync q q dck tckps<1:0> 2 tgate t cy 10 tcs tgate sosc input gate output clock input select detail lprc input 2 t1ecs<1:0> t1ck input soscsel<1:0> lprc clock input select prescaler 1, 8, 64, 256 txck input tmr1 gate sync clock output to tmr1 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 184 ? 2015 microchip technology inc. register 12-1: t1con: ti mer1 control register ( 1 ) r/w-0 u-0 r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 ton t s i d l t e c s 1t e c s 0 bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 u-0 tgate tckps1 tckps0 tsync tcs bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 ton: timer1 on bit 1 = starts 16-bit timer1 0 = stops 16-bit timer1 bit 14 unimplemented: read as 0 bit 13 tsidl: timer1 stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-10 unimplemented: read as 0 bit 9-8 tecs<1:0>: timer1 extended clock source select bits (selected when tcs = 1 ) 11 = generic timer (txck) external input 10 = lprc oscillator 01 = t1ck external clock input 00 = sosc bit 7 unimplemented: read as 0 bit 6 tgate: timer1 gated time accumulation enable bit when tcs = 1 : this bit is ignored. when tcs = 0 : 1 = gated time accumulation is enabled 0 = gated time accumulation is disabled bit 5-4 tckps<1:0>: timer1 input clock prescale select bits 11 = 1:256 10 = 1:64 01 = 1:8 00 = 1:1 bit 3 unimplemented: read as 0 bit 2 tsync: timer1 external clock input synchronization select bit when tcs = 1 : 1 = synchronizes the external clock input 0 = does not synchronize the external clock input when tcs = 0 : this bit is ignored. bit 1 tcs: timer1 clock source select bit 1 = extended clock is selected by the timer 0 = internal clock (f osc /2) bit 0 unimplemented: read as 0 note 1: changing the value of t1con while the timer is running (ton = 1 ) causes the timer prescale counter to reset and is not recommended. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 185 pic24fj1024ga610/gb610 family 13.0 timer2/3 and timer4/5 the timer2/3 and timer4/5 modules are 32-bit timers, which can also be configured as four independent, 16-bit timers with selectable operating modes. as 32-bit timers, timer2/3 and timer4/5 can each operate in three modes: two independent 16-bit timers with all 16-bit operating modes (except asynchronous counter mode) single 32-bit timer single 32-bit synchronous counter they also support these features: timer gate operation selectable prescaler settings timer operation during idle and sleep modes interrupt on a 32-bit period register match a/d event trigger (only on timer2/3 in 32-bit mode and timer3 in 16-bit mode) individually, all four of the 16-bit timers can function as synchronous timers or counters. they also offer the features listed above, except for the a/d event trigger. this trigger is implemented only on timer2/3 in 32-bit mode and timer3 in 16-bit mode. the operating modes and enabled features are determined by setting the appropriate bit(s) in the t2con, t3con, t4con and t5con registers. t2con and t4con are shown in generic form in register 13-1 ; t3con and t5con are shown in register 13-2 . for 32-bit timer/counter operation, timer2 and timer4 are the least significant word; timer3 and timer5 are the most significant word of the 32-bit timers. to configure timer2/3 or timer4/5 for 32-bit operation: 1. set the t32 or t45 bit (t2con<3> or t4con<3> = 1 ). 2. select the prescaler ratio for timer2 or timer4 using the tckps<1:0> bits. 3. set the clock and gating modes using the tcs and tgate bits. if tcs is set to an external clock, rpinrx (tyck) must be configured to an available rpn/rpin pin. for more informa- tion, see section 11.4 peripheral pin select (pps) . 4. load the timer period value. pr3 (or pr5) will contain the most significant word (msw) of the value, while pr2 (or pr4) contains the least significant word (lsw). 5. if interrupts are required, set the interrupt enable bit, t3ie or t5ie. use the priority bits, t3ip<2:0> or t5ip<2:0>, to set the interrupt priority. note that while timer2 or timer4 controls the timer, the interrupt appears as a timer3 or timer5 interrupt. 6. set the ton bit (= 1 ). the timer value, at any point, is stored in the register pair, tmr<3:2> (or tmr<5:4>). tmr3 (tmr5) always contains the most significant word of the count, while tmr2 (tmr4) contains the least significant word. to configure any of the timers for individual 16-bit operation: 1. clear the t32 bit corresponding to that timer (t2con<3> for timer2 and timer3 or t4con<3> for timer4 and timer5). 2. select the timer prescaler ratio using the tckps<1:0> bits. 3. set the clock and gating modes using the tcs and tgate bits. see section 11.4 peripheral pin select (pps) for more information. 4. load the timer period value into the prx register. 5. if interrupts are required, set the interrupt enable bit, txie. use the priority bits, txip<2:0>, to set the interrupt priority. 6. set the ton (txcon<15> = 1 ) bit. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference manual , timers (ds39704), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. note: for 32-bit operation, t3con and t5con control bits are ignored. only t2con and t4con control bits are used for setup and control. timer2 and timer4 clock and gate inputs are utilized for the 32-bit timer modules, but an interrupt is generated with the timer3 or timer5 interrupt flags. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 186 ? 2015 microchip technology inc. figure 13-1: timer2/3 and timer4/5 (32-bit) block diagram tmr3 tmr2 set t3if (t5if) equal comparator pr3 pr2 reset lsb msb note 1: the 32-bit timer configuration bit, t32, must be set for 32-bit timer/counter operation. all control bits are respective to the t2con and t4con registers. 2: the timer clock input must be assigned to an available rpn/rpin pin before use. see section 11.4 peripheral pin select (pps) for more information. 3: the a/d event trigger is available only on timer2/3 in 32-bit mode and timer3 in 16-bit mode. data bus<15:0> read tmr2 (tmr4) (1) write tmr2 (tmr4) (1) 16 16 16 q qd ck tgate 0 1 tckps<1:0> 2 a/d event trigger (3) (pr5) (pr4) (tmr5) (tmr4) t2ck (t4ck) t cy tcs (2) tgate (2) sosc input lprc input tecs<1:0> txck gate sync prescaler 1, 8, 64, 256 sync tmr3hld (tmr5hld) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 187 pic24fj1024ga610/gb610 family figure 13-2: timer2 and timer4 (1 6-bit synchronous) block diagram figure 13-3: timer3 and timer5 (1 6-bit asynchronous) block diagram ton tckps<1:0> prescaler 1, 8, 64, 256 2 t2ck set t2if (t4if) equal reset q qd ck tgate 10 (t4ck) sync note 1: the timer clock input must be assigned to an available rpn/rpin pin before use. see section 11.4 peripheral pin select (pps) for more information. tmr2 (tmr4) t cy tcs (1) tgate (1) sosc input lprc input tecs<1:0> txck gate sync comparator pr2 (pr4) ton tckps<1:0> 2 pr3 (pr5) set t3if (t5if) equal comparator tmr3 (tmr5) reset q qd ck tgate 10 a/d event trigger (2) prescaler 1, 8, 64, 256 note 1: the timer clock input must be assigned to an available rpn/rpin pin before use. see section 11.4 peripheral pin select (pps) for more information. 2: the a/d event trigger is available only on timer3. t3ck (t5ck) t cy tcs (1) tgate (1) sosc input lprc input tecs<1:0> txck gate sync downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 188 ? 2015 microchip technology inc. register 13-1: txcon: timer2 and timer4 control register ( 1 ) r/w-0 u-0 r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 ton t s i d l tecs1 ( 2 ) tecs0 ( 2 ) bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 u-0 tgate tckps1 tckps0 t32 ( 3 , 4 ) t c s ( 2 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 ton: timerx on bit when txcon<3> = 1 : 1 = starts 32-bit timerx/y 0 = stops 32-bit timerx/y when txcon<3> = 0 : 1 = starts 16-bit timerx 0 = stops 16-bit timerx bit 14 unimplemented: read as 0 bit 13 tsidl: timerx stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-10 unimplemented: read as 0 bit 9-8 tecs<1:0>: timerx extended clock source select bits (selected when tcs = 1 ) ( 2 ) when tcs = 1 : 11 = generic timer (txck) external input 10 = lprc oscillator 01 = tyck external clock input 00 = sosc when tcs = 0 : these bits are ignored; the timer is clocked from the internal system clock (f osc /2). bit 7 unimplemented: read as 0 bit 6 tgate: timerx gated time accumulation enable bit when tcs = 1 : this bit is ignored. when tcs = 0 : 1 = gated time accumulation is enabled 0 = gated time accumulation is disabled bit 5-4 tckps<1:0>: timerx input clock prescale select bits 11 = 1:256 10 = 1:64 01 = 1:8 00 = 1:1 note 1: changing the value of txcon while the timer is running (ton = 1 ) causes the timer prescale counter to reset and is not recommended. 2: if tcs = 1 and tecs<1:0> = x1 , the selected external timer input (txck or tyck) must be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . 3: in 32-bit mode, the t3con or t5con control bits do not affect 32-bit timer operation. 4: this bit is labeled t45 in the t4con register. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 189 pic24fj1024ga610/gb610 family bit 3 t32: 32-bit timer mode select bit ( 3 , 4 ) 1 = timerx and timery form a single 32-bit timer 0 = timerx and timery act as two 16-bit timers in 32-bit mode, t3con control bits do not affect 32-bit timer operation. bit 2 unimplemented: read as 0 bit 1 tcs: timerx clock source select bit ( 2 ) 1 = timer source is selected by tecs<1:0> 0 = internal clock (f osc /2) bit 0 unimplemented: read as 0 register 13-1: txcon: timer2 and timer4 control register ( 1 ) (continued) note 1: changing the value of txcon while the timer is running (ton = 1 ) causes the timer prescale counter to reset and is not recommended. 2: if tcs = 1 and tecs<1:0> = x1 , the selected external timer input (txck or tyck) must be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . 3: in 32-bit mode, the t3con or t5con control bits do not affect 32-bit timer operation. 4: this bit is labeled t45 in the t4con register. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 190 ? 2015 microchip technology inc. register 13-2: tycon: timer3 and timer5 control register ( 1 ) r/w-0 u-0 r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 ton ( 2 ) t s i d l ( 2 ) tecs1 ( 2 , 3 ) tecs0 ( 2 , 3 ) bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 u-0 t g a t e ( 2 ) tckps1 ( 2 ) tckps0 ( 2 ) t c s ( 2,3 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 ton: timery on bit ( 2 ) 1 = starts 16-bit timery 0 = stops 16-bit timery bit 14 unimplemented: read as 0 bit 13 tsidl: timery stop in idle mode bit ( 2 ) 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-10 unimplemented: read as 0 bit 9-8 tecs<1:0>: timery extended clock source select bits (selected when tcs = 1 ) ( 2,3 ) 11 = generic timer (txck) external input 10 = lprc oscillator 01 = tyck external clock input 00 = sosc bit 7 unimplemented: read as 0 bit 6 tgate: timery gated time accumulation enable bit ( 2 ) when tcs = 1 : this bit is ignored. when tcs = 0 : 1 = gated time accumulation is enabled 0 = gated time accumulation is disabled bit 5-4 tckps<1:0>: timery input clock prescale select bits ( 2 ) 11 = 1:256 10 = 1:64 01 = 1:8 00 = 1:1 bit 3-2 unimplemented: read as 0 bit 1 tcs: timery clock source select bit ( 2,3 ) 1 = external clock from pin, tyck (on the rising edge) 0 = internal clock (f osc /2) bit 0 unimplemented: read as 0 note 1: changing the value of tycon while the timer is running (ton = 1 ) causes the timer prescale counter to reset and is not recommended. 2: when 32-bit operation is enabled (t2con<3> or t4con<3> = 1 ), these bits have no effect on timery operation; all timer functions are set through t2con and t4con. 3: if tcs = 1 and tecs<1:0> = x1 , the selected external timer input (tyck) must be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 191 pic24fj1024ga610/gb610 family 14.0 input capture with dedicated timers devices in the pic24fj1024ga610/gb610 family contain six independent input capture modules. each of the modules offers a wide range of configuration and operating options for capturing external pulse events and generating interrupts. key features of the input capture module include: hardware-configurable for 32-bit operation in all modes by cascading two adjacent modules synchronous and trigger modes of output compare operation with up to 31 user-selectable sync/trigger sources available a 4-level fifo buffer for capturing and holding timer values for several events configurable interrupt generation up to 6 clock sources available for each module, driving a separate internal 16-bit counter the module is controlled through two registers: icxcon1 ( register 14-1 ) and icxcon2 ( register 14-2 ). a general block diagram of the module is shown in figure 14-1 . 14.1 general operating modes 14.1.1 synchronous and trigger modes when the input capture module operates in a free- running mode, the internal 16-bit counter, icxtmr, counts up continuously, wrapping around from ffffh to 0000h on each overflow. its period is synchronized to the selected external clock source. when a capture event occurs, the current 16-bit value of the internal counter is written to the fifo buffer. in synchronous mode, the module begins capturing events on the icx pin as soon as its selected clock source is enabled. whenever an event occurs on the selected sync source, the internal counter is reset. in trigger mode, the module waits for a sync event from another internal module to occur before allowing the internal counter to run. standard, free-running operation is selected by setting the syncsel<4:0> bits (icxcon2<4:0>) to 00000 and clearing the ictrig bit (icxcon2<7>). synchro- nous and trigger modes are selected any time the syncselx bits are set to any value except 00000 . the ictrig bit selects either synchronous or trigger mode; setting the bit selects trigger mode operation. in both modes, the syncselx bits determine the sync/ trigger source. when the syncselx bits are set to 00000 and ictrig is set, the module operates in software trigger mode. in this case, capture operations are started by manually setting the trigstat bit (icxcon2<6>). figure 14-1: input capture x block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family refer- ence manual , input capture with dedicated timer (ds70000352), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. note 1: the icx input must be assigned to an available rpn/rpin pin before use. see section 11.4 peripheral pin select (pps) for more information. icxbuf 4-level fifo buffer icx pin (1) icm<2:0> set icxif edge detect logic ici1<:0> icov, icbne system bus prescaler counter 1:1/4/16 and clock synchronizer clock select icx clock sources sync and ictsel<2:0> syncsel<4:0> trigger 16 16 16 increment reset sync and trigger logic trigger sources icxtmr interrupt logic event and downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 192 ? 2015 microchip technology inc. 14.1.2 cascaded (32-bit) mode by default, each module operates independently with its own 16-bit timer. to increase resolution, adjacent even and odd modules can be configured to function as a single 32-bit module. (for example, modules 1 and 2 are paired, as are modules 3 and 4, and so on.) the odd numbered module (icx) provides the least signif- icant 16 bits of the 32-bit register pairs and the even numbered module (icy) provides the most significant 16 bits. wrap-arounds of the icx registers cause an increment of their corresponding icy registers. cascaded operation is configured in hardware by setting the ic32 bits (icxcon2<8>) for both modules. 14.2 capture operations the input capture module can be configured to capture timer values and generate interrupts on rising edges on icx or all transitions on icx. captures can be config- ured to occur on all rising edges or just some (every 4 th or 16 th ). interrupts can be independently configured to generate on each event or a subset of events. to set up the module for capture operations: 1. configure the icx input for one of the available peripheral pin select pins. 2. if synchronous mode is to be used, disable the sync source before proceeding. 3. make sure that any previous data has been removed from the fifo by reading icxbuf until the icbne bit (icxcon1<3>) is cleared. 4. set the syncselx bits (icxcon2<4:0>) to the desired sync/trigger source. 5. set the ictselx bits (icxcon1<12:10>) for the desired clock source. 6. set the icix bits (icxcon1<6:5>) to the desired interrupt frequency. 7. select synchronous or trigger mode operation: a) check that the syncselx bits are not set to 00000 . b) for synchronous mode, clear the ictrig bit (icxcon2<7>). c) for trigger mode, set ictrig and clear the trigstat bit (icxcon2<6>). 8. set the icmx bits (icxcon1<2:0>) to the desired operational mode. 9. enable the selected sync/trigger source. for 32-bit cascaded operations, the setup procedure is slightly different: 1. set the ic32 bits for both modules (icycon2<8> and icxcon2<8>), enabling the even numbered module first. this ensures the modules will start functioning in unison. 2. set the ictselx and syncselx bits for both modules to select the same sync/trigger and time base source. set the even module first, then the odd module. both modules must use the same ictselx and syncselx bits settings. 3. clear the ictrig bit of the even module (icycon2<7>). this forces the module to run in synchronous mode with the odd module, regardless of its trigger setting. 4. use the odd modules icix bits (icxcon1<6:5>) to set the desired interrupt frequency. 5. use the ictrig bit of the odd module (icxcon2<7>) to configure trigger or synchronous mode operation. 6. use the icmx bits of the odd module (icxcon1<2:0>) to set the desired capture mode. the module is ready to capture events when the time base and the sync/trigger source are enabled. when the icbne bit (icxcon1<3>) becomes set, at least one capture value is available in the fifo. read input capture values from the fifo until the icbne clears to 0 . for 32-bit operation, read both the icxbuf and icybuf for the full 32-bit timer value (icxbuf for the lsw, icybuf for the msw). at least one capture value is available in the fifo buffer when the odd modules icbne bit (icxcon1<3>) becomes set. continue to read the buffer registers until icbne is cleared (performed automatically by hardware). note: for synchronous mode operation, enable the sync source as the last step. both input capture modules are held in reset until the sync source is enabled. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 193 pic24fj1024ga610/gb610 family register 14-1: icxcon1: input capture x control register 1 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 icsidl ictsel2 ictsel1 ictsel0 bit 15 bit 8 u-0 r/w-0 r/w-0 r-0, hsc r-0, hsc r/w-0 r/w-0 r/w-0 ici1 ici0 icov icbne icm2 ( 1 ) icm1 ( 1 ) icm0 ( 1 ) bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13 icsidl: input capture x stop in idle control bit 1 = input capture x halts in cpu idle mode 0 = input capture x continues to operate in cpu idle mode bit 12-10 ictsel<2:0>: input capture x timer select bits 111 = system clock (f osc /2) 110 = reserved 101 = reserved 100 = timer1 011 = timer5 010 = timer4 001 = timer2 000 = timer3 bit 9-7 unimplemented: read as 0 bit 6-5 ici<1:0>: input capture x select number of captures per interrupt bits 11 = interrupt on every fourth capture event 10 = interrupt on every third capture event 01 = interrupt on every second capture event 00 = interrupt on every capture event bit 4 icov: input capture x overflow status flag bit (read-only) 1 = input capture x overflow has occurred 0 = no input capture x overflow has occurred bit 3 icbne: input capture x buffer empty status bit (read-only) 1 = input capture x buffer is not empty, at least one more capture value can be read 0 = input capture x buffer is empty bit 2-0 icm<2:0>: input capture x mode select bits ( 1 ) 111 = interrupt mode: input capture x functions as an interrupt pin only when the device is in sleep or idle mode (rising edge detect only, all other control bits are not applicable) 110 = unused (module is disabled) 101 = prescaler capture mode: capture on every 16 th rising edge 100 = prescaler capture mode: capture on every 4 th rising edge 011 = simple capture mode: capture on every rising edge 010 = simple capture mode: capture on every falling edge 001 = edge detect capture mode: capture on every edge (rising and falling); ici<1:0> bits do not control interrupt generation for this mode 000 = input capture x module is turned off note 1: the icx input must also be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 194 ? 2015 microchip technology inc. register 14-2: icxcon2: input capture x control register 2 u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 i c 3 2 bit 15 bit 8 r/w-0 r/w-0, hs u-0 r/w-0 r/w-1 r/w-1 r/w-0 r/w-1 ictrig trigstat syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 bit 7 bit 0 legend: hs = hardware settable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-9 unimplemented: read as 0 bit 8 ic32: cascade two input capture modules enable bit (32-bit operation) 1 = icx and icy operate in cascade as a 32-bit module (this bit must be set in both modules) 0 = icx functions independently as a 16-bit module bit 7 ictrig: input capture x sync/trigger select bit 1 = triggers icx from the source designated by the syncselx bits 0 = synchronizes icx with the source designated by the syncselx bits bit 6 trigstat: timer trigger status bit 1 = timer source has been triggered and is running (set in hardware, can be set in software) 0 = timer source has not been triggered and is being held clear bit 5 unimplemented: read as 0 note 1: use these inputs as trigger sources only and never as sync sources. 2: never use an input capture x module as its own trigger source by selecting this mode. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 195 pic24fj1024ga610/gb610 family bit 4-0 syncsel<4:0>: synchronization/trigger source selection bits 11111 = ic6 interrupt ( 2 ) 11110 = ic5 interrupt ( 2 ) 11101 = ic4 interrupt ( 2 ) 11100 = ctmu trigger ( 1 ) 11011 = a/d interrupt ( 1 ) 11010 = cmp3 trigger ( 1 ) 11001 = cmp2 trigger ( 1 ) 11000 = cmp1 trigger ( 1 ) 10111 = sccp5 ic/oc interrupt 10110 = sccp4 ic/oc interrupt 10101 = mccp3 ic/oc interrupt 10100 = mccp2 ic/oc interrupt 10011 = mccp1 ic/oc interrupt 10010 = ic3 interrupt ( 2 ) 10001 = ic2 interrupt ( 2 ) 10000 = ic1 interrupt ( 2 ) 01111 = sccp7 ic/oc interrupt 01110 = sccp6 ic/oc interrupt 01101 = timer3 match event 01100 = timer2 match event 01011 = timer1 match event 01010 = sccp7 sync/trigger out 01001 = sccp6 sync/trigger out 01000 = sccp5 sync/trigger out 00111 = sccp4 sync/trigger out 00110 = mccp3 sync/trigger out 00101 = mccp2 sync/trigger out 00100 = mccp1 sync/trigger out 00011 = oc3 sync/trigger out 00010 = oc2 sync/trigger out 00001 = oc1 sync/trigger out 00000 = off register 14-2: icxcon2: input capture x control register 2 (continued) note 1: use these inputs as trigger sources only and never as sync sources. 2: never use an input capture x module as its own trigger source by selecting this mode. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 196 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 197 pic24fj1024ga610/gb610 family 15.0 output compare with dedicated timers all devices in the pic24fj1024ga610/gb610 family feature six independent output compare modules. each of these modules offers a wide range of configu- ration and operating options for generating pulse trains on internal device events, and can produce pulse- width modulated (pwm) waveforms for driving power applications. key features of the output compare module include: hardware-configurable for 32-bit operation in all modes by cascading two adjacent modules synchronous and trigger modes of output compare operation with up to 31 user-selectable sync/trigger sources available two separate period registers (a main register, ocxr, and a secondary register, ocxrs) for greater flexibility in generating pulses of varying widths configurable for single pulse or continuous pulse generation on an output event or continuous pwm waveform generation up to 6 clock sources available for each module, driving a separate internal 16-bit counter 15.1 general operating modes 15.1.1 synchronous and trigger modes when the output compare module operates in a free- running mode, the internal 16-bit counter, ocxtmr, runs counts up continuously, wrapping around from 0xffff to 0x0000 on each overflow. its period is synchronized to the selected external clock source. compare or pwm events are generated each time a match between the internal counter and one of the period registers occurs. in synchronous mode, the module begins performing its compare or pwm operation as soon as its selected clock source is enabled. whenever an event occurs on the selected sync source, the modules internal counter is reset. in trigger mode, the module waits for a sync event from another internal module to occur before allowing the counter to run. free-running mode is selected by default or any time that the syncsel<4:0> bits (ocxcon2<4:0>) are set to 00000 . synchronous or trigger modes are selected any time the syncselx bits are set to any value except 00000 . the octrig bit (ocxcon2<7>) selects either synchronous or trigger mode; setting the bit selects trigger mode operation. in both modes, the syncselx bits determine the sync/trigger source. 15.1.2 cascaded (32-bit) mode by default, each module operates independently with its own set of 16-bit timer and duty cycle registers. to increase resolution, adjacent even and odd modules can be configured to function as a single 32-bit module. (for example, modules 1 and 2 are paired, as are modules 3 and 4, and so on.) the odd numbered module (ocx) provides the least significant 16 bits of the 32-bit register pairs and the even numbered module (ocy) provides the most significant 16 bits. wrap-arounds of the ocx registers cause an increment of their corresponding ocy registers. cascaded operation is configured in hardware by set- ting the oc32 bit (ocxcon2<8>) for both modules. for more details on cascading, refer to the dspic33/ pic24 family reference manual , output compare with dedicated timer (ds70005159). note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference manual, output compare with dedicated timer (ds70005159), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 198 ? 2015 microchip technology inc. figure 15-1: output compare x block diagram (16-bit mode) 15.2 compare operations in compare mode ( figure 15-1 ), the output compare module can be configured for single-shot or continu- ous mode pulse generation. it can also repeatedly toggle an output pin on each timer event. to set up the module for compare operations: 1. configure the ocx output for one of the available peripheral pin select pins if available on the ocx module you are using. otherwise, configure the dedicated ocx output pins. 2. calculate the required values for the ocxr and (for double compare modes) ocxrs duty cycle registers: a) determine the instruction clock cycle time. take into account the frequency of the external clock to the timer source (if one is used) and the timer prescaler settings. b) calculate the time to the rising edge of the output pulse relative to the timer start value (0000h). c) calculate the time to the falling edge of the pulse based on the desired pulse width and the time to the rising edge of the pulse. 3. write the rising edge value to ocxr and the falling edge value to ocxrs. 4. set the timer period register, pry, to a value equal to or greater than the value in ocxrs. 5. set the ocm<2:0> bits for the appropriate compare operation (= 0xx ). 6. for trigger mode operations, set octrig to enable trigger mode. set or clear trigmode to configure trigger operation and trigstat to select a hardware or software trigger. for synchronous mode, clear octrig. 7. set the syncsel<4:0> bits to configure the trigger or sync source. if free-running timer operation is required, set the syncselx bits to 00000 (no sync/trigger source). 8. select the time base source with the octsel<2:0> bits. if necessary, set the ton bit for the selected timer, which enables the com- pare time base to count. synchronous mode operation starts as soon as the time base is enabled; trigger mode operation starts after a trigger source event occurs. ocxr and comparator ocxtmr ocxcon1 ocxcon2 ocx interrupt ocx pin (1) ocxrs comparator match event match event trigger and sync logic clock select increment reset ocx clock sources trigger and sync sources reset match event ocfa/ocfb (2) octsel<2:0> syncsel<4:0> trigstat trigmode octrig ocm<2:0> ocinv octris fltout flttrien fltmd enflt<2:0> ocflt<2:0> note 1: the ocx outputs must be assigned to an available rpn pin before use. see section 11.4 peripheral pin select (pps) for more information. 2: the ocfa/ocfb fault inputs must be assigned to an available rpn/rpin pin before use. see section 11.4 peripheral pin select (pps) for more information. dcb<1:0> dcb<1:0> ocx output and fault logic downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 199 pic24fj1024ga610/gb610 family for 32-bit cascaded operation, these steps are also necessary: 1. set the oc32 bits for both registers (ocycon2<8> and ocxcon2<8>). enable the even numbered module first to ensure the modules will start functioning in unison. 2. clear the octrig bit of the even module (ocycon2<7>), so the module will run in synchronous mode. 3. configure the desired output and fault settings for ocy. 4. force the output pin for ocx to the output state by clearing the octris bit. 5. if trigger mode operation is required, configure the trigger options in ocx by using the octrig (ocxcon2<7>), trigmode (ocxcon1<3>) and syncsel<4:0> (ocxcon2<4:0>) bits. 6. configure the desired compare or pwm mode of operation (ocm<2:0>) for ocy first, then for ocx. depending on the output mode selected, the module holds the ocx pin in its default state and forces a tran- sition to the opposite state when ocxr matches the timer. in double compare modes, ocx is forced back to its default state when a match with ocxrs occurs. the ocxif interrupt flag is set after an ocxr match in single compare modes and after each ocxrs match in double compare modes. single-shot pulse events only occur once, but may be repeated by simply rewriting the value of the ocxcon1 register. continuous pulse events continue indefinitely until terminated. 15.3 pulse-width modulation (pwm) mode in pwm mode, the output compare module can be configured for edge-aligned or center-aligned pulse waveform generation. all pwm operations are double- buffered (buffer registers are internal to the module and are not mapped into sfr space). to configure the output compare module for pwm operation: 1. configure the ocx output for one of the available peripheral pin select pins if available on the oc module you are using. otherwise, configure the dedicated ocx output pins. 2. calculate the desired duty cycles and load them into the ocxr register. 3. calculate the desired period and load it into the ocxrs register. 4. select the current ocx as the synchronization source by writing 0x1f to the syncsel<4:0> bits (ocxcon2<4:0>) and 0 to the octrig bit (ocxcon2<7>). 5. select a clock source by writing to the octsel<2:0> bits (ocxcon1<12:10>). 6. enable interrupts, if required, for the timer and output compare modules. the output compare interrupt is required for pwm fault pin utilization. 7. select the desired pwm mode in the ocm<2:0> bits (ocxcon1<2:0>). 8. appropriate fault inputs may be enabled by using the enflt<2:0> bits as described in register 15-1 . 9. if a timer is selected as a clock source, set the selected timer prescale value. the selected timers prescaler output is used as the clock input for the ocx timer, and not the selected timer output. note: this peripheral contains input and output functions that may need to be configured by the peripheral pin select. see section 11.4 peripheral pin select (pps) for more information. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 200 ? 2015 microchip technology inc. figure 15-2: output compare x block diagram (double-buffered, 16-bit pwm mode) 15.3.1 pwm period the pwm period is specified by writing to pry, the timer period register. the pwm period can be calculated using equation 15-1 . equation 15-1: calculating the pwm period ( 1 ) comparator ocxtmr ocxcon1 ocxcon2 ocx interrupt ocx pin (1) ocxrs buffer comparator match match trigger and sync logic clock select increment reset ocx clock sources trigger and sync sources reset match event ocfa/ocfb (2) octsel<2:0> syncsel<4:0> trigstat trigmode octrig ocm<2:0> ocinv octris fltout flttrien fltmd enflt<2:0> ocflt<2:0> ocxrs event event rollover rollover/reset rollover/reset note 1: the ocx outputs must be assigned to an available rpn pin before use. see section 11.4 peripheral pin select (pps) for more information. 2: the ocfa/ocfb fault inputs must be assigned to an available rpn/rpin pin before use. see section 11.4 peripheral pin select (pps) for more information. ocxr and dcb<1:0> dcb<1:0> ocxr and dcb<1:0> buffers ocx output and fault logic note 1: based on t cy = t osc * 2; doze mode and pll are disabled. pwm period = [(pry) + 1 t cy (timer prescale value) where: pwm frequency = 1/[pwm period] note: a pry value of n will produce a pwm period of n + 1 time base count cycles. for example, a value of 7, written into the pry register, will yield a period consisting of 8 time base cycles. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 201 pic24fj1024ga610/gb610 family 15.3.2 pwm duty cycle the pwm duty cycle is specified by writing to the ocxrs and ocxr registers. the ocxrs and ocxr registers can be written to at any time, but the duty cycle value is not latched until a match between pry and tmry occurs (i.e., the period is complete). this provides a double buffer for the pwm duty cycle and is essential for glitchless pwm operation. some important boundary parameters of the pwm duty cycle include: if ocxr, ocxrs and pry are all loaded with 0000h, the ocx pin will remain low (0% duty cycle). if ocxrs is greater than pry, the pin will remain high (100% duty cycle). see example 15-1 for pwm mode timing details. ta b l e 1 5 - 1 and table 15-2 show example pwm frequencies and resolutions for a device operating at 4 mips and 10 mips, respectively. equation 15-2: calculation for maximum pwm resolution ( 1 ) example 15-1: pwm period and duty cycle calculations ( 1 ) note 1: based on f cy = f osc /2; doze mode and pll are disabled. maximum pwm resolution (bits) = log 10 log 10 (2) fpwm (timer prescale value) bits f cy () 1. find the timer period register value for a desired pwm frequency of 52.08 khz, where f osc = 8 mhz with pll (32 mhz device clock rate) and a timer2 prescaler setting of 1:1. t cy = 2 * t osc = 62.5 ns pwm period = 1/pwm frequency = 1/52.08 khz = 19.2 s pwm period = (pr2 + 1) t cy (timer2 prescale value) 19.2 s = (pr2 + 1) 62.5 ns 1 pr2 = 306 2. find the maximum resolution of the duty cycle that can be used with a 52.08 khz frequency and a 32 mhz device clock rate: pwm resolution = log 10 (f cy /f pwm )/log 10 2) bits = (log 10 (16 mhz/52.08 khz)/log 10 2) bits = 8.3 bits note 1: based on t cy = 2 * t osc ; doze mode and pll are disabled. table 15-1: example pwm frequencies and resolutions at 4 mips (f cy = 4 mhz) ( 1 ) pwm frequency 7.6 hz 61 hz 122 hz 977 hz 3.9 khz 31.3 khz 125 khz t i m e r p r e s c a l e r r a t i o 8111111 period register value ffffh ffffh 7fffh 0fffh 03ffh 007fh 001fh resolution (bits) 16 16 15 12 10 7 5 note 1: based on f cy = f osc /2; doze mode and pll are disabled. table 15-2: example pwm frequencies and resolutions at 16 mips (f cy = 16 mhz) ( 1 ) pwm frequency 30.5 hz 244 hz 488 hz 3.9 khz 15.6 khz 125 khz 500 khz t i m e r p r e s c a l e r r a t i o 8111111 period register value ffffh ffffh 7fffh 0fffh 03ffh 007fh 001fh resolution (bits) 16 16 15 12 10 7 5 note 1: based on f cy = f osc /2; doze mode and pll are disabled. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 202 ? 2015 microchip technology inc. register 15-1: ocxcon1: output compare x control register 1 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ocsidl octsel2 octsel1 octsel0 enflt2 ( 2 ) enflt1 ( 2 ) bit 15 bit 8 r/w-0 r/w-0, hsc r/w-0, hsc r/w-0, hsc r/w-0 r/w-0 r/w-0 r/w-0 enflt0 ( 2 ) ocflt2 ( 2 , 3 ) ocflt1 ( 2 , 4 ) ocflt0 ( 2 , 4 ) trigmode ocm2 ( 1 ) ocm1 ( 1 ) ocm0 ( 1 ) bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13 ocsidl: output compare x stop in idle mode control bit 1 = output compare x halts in cpu idle mode 0 = output compare x continues to operate in cpu idle mode bit 12-10 octsel<2:0>: output compare x timer select bits 111 = peripheral clock (f cy ) 110 = reserved 101 = reserved 100 = timer1 clock (only synchronous clock is supported) 011 = timer5 clock 010 = timer4 clock 001 = timer3 clock 000 = timer2 clock bit 9 enflt2: fault input 2 enable bit ( 2 ) 1 = fault 2 (comparator 1/2/3 out) is enabled ( 3 ) 0 = fault 2 is disabled bit 8 enflt1: fault input 1 enable bit ( 2 ) 1 = fault 1 (ocfb pin) is enabled ( 4 ) 0 = fault 1 is disabled bit 7 enflt0: fault input 0 enable bit ( 2 ) 1 = fault 0 (ocfa pin) is enabled ( 4 ) 0 = fault 0 is disabled bit 6 ocflt2: output compare x pwm fault 2 (comparator 1/2/3) condition status bit ( 2 , 3 ) 1 = pwm fault 2 has occurred 0 = no pwm fault 2 has occurred bit 5 ocflt1: output compare x pwm fault 1 (ocfb pin) condition status bit ( 2 , 4 ) 1 = pwm fault 1 has occurred 0 = no pwm fault 1 has occurred note 1: the ocx output must also be configured to an available rpn pin. for more information, see section 11.4 peripheral pin select (pps) . 2: the fault input enable and fault status bits are valid when ocm<2:0> = 111 or 110 . 3: the comparator 1 output controls the oc1-oc3 channels, comparator 2 output controls the oc4-oc6 channels, comparator 3 output controls the oc7-oc9 channels. 4: the ocfa/ocfb fault inputs must also be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 203 pic24fj1024ga610/gb610 family bit 4 ocflt0: pwm fault 0 (ocfa pin) condition status bit ( 2 , 4 ) 1 = pwm fault 0 has occurred 0 = no pwm fault 0 has occurred bit 3 trigmode: trigger status mode select bit 1 = trigstat (ocxcon2<6>) is cleared when ocxrs = ocxtmr or in software 0 = trigstat is only cleared by software bit 2-0 ocm<2:0>: output compare x mode select bits ( 1 ) 111 = center-aligned pwm mode on ocx ( 2 ) 110 = edge-aligned pwm mode on ocx ( 2 ) 101 = double compare continuous pulse mode: initialize the ocx pin low; toggle the ocx state continuously on alternate matches of ocxr and ocxrs 100 = double compare single-shot mode: initialize the ocx pin low; toggle the ocx state on matches of ocxr and ocxrs for one cycle 011 = single compare continuous pulse mode: compare events continuously toggle the ocx pin 010 = single compare single-shot mode: initialize ocx pin high; compare event forces the ocx pin low 001 = single compare single-shot mode: initialize ocx pin low; compare event forces the ocx pin high 000 = output compare channel is disabled register 15-1: ocxcon1: output comp are x control register 1 (continued) note 1: the ocx output must also be configured to an available rpn pin. for more information, see section 11.4 peripheral pin select (pps) . 2: the fault input enable and fault status bits are valid when ocm<2:0> = 111 or 110 . 3: the comparator 1 output controls the oc1-oc3 chan nels, comparator 2 output controls the oc4-oc6 channels, comparator 3 output controls the oc7-oc9 channels. 4: the ocfa/ocfb fault inputs must also be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 204 ? 2015 microchip technology inc. register 15-2: ocxcon2: output compare x control register 2 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 fltmd fltout flttrien ocinv dcb1 ( 3 ) dcb0 ( 3 ) oc32 bit 15 bit 8 r/w-0 r/w-0, hs r/w-0 r/w-0 r/w-1 r/w-1 r/w-0 r/w-0 octrig trigstat octris syncsel4 syncsel3 syncsel2 syncsel1 syncsel0 bit 7 bit 0 legend: hs = hardware settable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 fltmd: fault mode select bit 1 = fault mode is maintained until the fault source is removed and the corresponding ocflt0 bit is cleared in software 0 = fault mode is maintained until the fault source is removed and a new pwm period starts bit 14 fltout: fault out bit 1 = pwm output is driven high on a fault 0 = pwm output is driven low on a fault bit 13 flttrien: fault output state select bit 1 = pin is forced to an output on a fault condition 0 = pin i/o condition is unaffected by a fault bit 12 ocinv: ocmp invert bit 1 = ocx output is inverted 0 = ocx output is not inverted bit 11 unimplemented: read as 0 bit 10-9 dcb<1:0>: pwm duty cycle least significant bits ( 3 ) 11 = delay ocx falling edge by ? of the instruction cycle 10 = delay ocx falling edge by ? of the instruction cycle 01 = delay ocx falling edge by ? of the instruction cycle 00 = ocx falling edge occurs at the start of the instruction cycle bit 8 oc32: cascade two oc modules enable bit (32-bit operation) 1 = cascade module operation is enabled 0 = cascade module operation is disabled bit 7 octrig: ocx trigger/sync select bit 1 = triggers ocx from the source designated by the syncselx bits 0 = synchronizes ocx with the source designated by the syncselx bits bit 6 trigstat: timer trigger status bit 1 = timer source has been triggered and is running 0 = timer source has not been triggered and is being held clear bit 5 octris: ocx output pin direction select bit 1 = ocx pin is tri-stated 0 = output compare peripheral x is connected to an ocx pin note 1: never use an output compare x module as its own trigger source, either by selecting this mode or another equivalent syncselx setting. 2: use these inputs as trigger sources only and never as sync sources. 3: the dcb<1:0> bits are double-buffered in the pwm modes only (ocm<2:0> (ocxcon1<2:0>) = 111 , 110 ). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 205 pic24fj1024ga610/gb610 family bit 4-0 syncsel<4:0>: trigger/synchronization source selection bits 11111 = ocx sync out ( 1 ) 11110 = octrig1 pin 11101 = octrig2 pin 11100 = ctmu trigger ( 2 ) 11011 = a/d interrupt ( 2 ) 11010 = cmp3 trigger ( 2 ) 11001 = cmp2 trigger ( 2 ) 11000 = cmp1 trigger ( 2 ) 10111 = sccp5 ic/oc interrupt 10110 = sccp4 ic/oc interrupt 10101 = mccp3 ic/oc interrupt 10100 = mccp2 ic/oc interrupt 10011 = mccp1 ic/oc interrupt 10010 = ic3 interrupt ( 2 ) 10001 = ic2 interrupt ( 2 ) 10000 = ic1 interrupt ( 2 ) 01111 = sccp7 ic/oc interrupt 01110 = sccp6 ic/oc interrupt 01101 = timer3 match event 01100 = timer2 match event (default) 01011 = timer1 match event 01010 = sccp7 sync/trigger out 01001 = sccp6 sync/trigger out 01000 = sccp5 sync/trigger out 00111 = sccp4 sync/trigger out 00110 = mccp3 sync/trigger out 00101 = mccp2 sync/trigger out 00100 = mccp1 sync/trigger out 00011 = oc5 sync/trigger out ( 1 ) 00010 = oc3 sync/trigger out ( 1 ) 00001 = oc1 sync/trigger out ( 1 ) 00000 = off, free-running mode with no synchronization and rollover at ffffh register 15-2: ocxcon2: output comp are x control register 2 (continued) note 1: never use an output compare x module as its own trigger source, either by selecting this mode or another equivalent syncselx setting. 2: use these inputs as trigger sources only and never as sync sources. 3: the dcb<1:0> bits are double-buffered in the pwm modes only (ocm<2:0> (ocxcon1<2:0>) = 111 , 110 ). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 206 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 207 pic24fj1024ga610/gb610 family 16.0 capture/compare/pwm/ timer modules (mccp and sccp) pic24fj1024ga610/gb610 family devices include several capture/compare/pwm/timer base modules, which provide the functionality of three different peripherals of earlier pic24f devices. the module can operate in one of three major modes: general purpose timer input capture output compare/pwm the module is provided in two different forms, distin- guished by the number of pwm outputs that the module can generate. single capture/compare/pwm (sccps) output modules provide only one pwm out- put. multiple capture/compare/pwm (mccps) output modules can provide up to six outputs and an extended range of power control features, depending on the pin count of the particular device. all other features of the modules are identical. the sccpx and mccpx modules can be operated only in one of the three major modes at any time. the other modes are not available unless the module is reconfigured for the new mode. a conceptual block diagram for the module is shown in figure 16-1 . all three modules share a time base genera- tor and a common timer register pair (ccpxtmrh/l); other shared hardware components are added as a particular mode requires. each module has a total of 8 control and status registers: ccpxcon1l ( register 16-1 ) ccpxcon1h ( register 16-2 ) ccpxcon2l ( register 16-3 ) ccpxcon2h ( register 16-4 ) ccpxcon3l ( register 16-5 ) ccpxcon3h ( register 16-6 ) ccpxstatl ( register 16-7 ) ccpxstath ( register 16-8 ) each module also includes 8 buffer/counter registers that serve as timer value registers or data holding buffers: ccpxtmrh/ccpxtmrl (timer high/low counters) ccpxprh/ccpxprl (timer period high/low) ccpxra (primary output compare data buffer) ccpxrb (secondary output compare data buffer) ccpxbufh/ccpxbufl (input capture high/low buffers) figure 16-1: mccpx/sccpx co nceptual block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information on the mccp/sccp modules, refer to the dspic33/pic24 family reference manual, capture/compare/pwm/timer (mccp and sccp) (ds33035a), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. clock sources input capture output compare/pwm t32 ccsel mod<3:0> sync and gating sources 16/32-bit auxiliary output (to ctmu) ccpxif cctxif external compare/pwm output(s) oefa/oefb timer sync/trigger out special trigger (to a/d) capture input time base generator ccpxtmrh/l downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 208 ? 2015 microchip technology inc. 16.1 time base generator the timer clock generator (tcg) generates a clock for the modules internal time base using one of the clock signals already available on the microcontroller. this is used as the time reference for the module in its three major modes. the internal time base is shown in figure 16-2 . there are eight inputs available to the clock generator, which are selected using the clksel<2:0> bits (ccpxcon1l<10:8>). available sources include the frc and lprc, the secondary oscillator and the tclki external clock inputs. the system clock is the default source (clksel<2:0> = 000 ). figure 16-2: timer clock generator clksel<2:0> tmrps<1:0> prescaler clock synchronizer tmrsync gate (1) ssdg clock sources to r e s t of module note 1: gating available in timer modes only. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 209 pic24fj1024ga610/gb610 family 16.2 general purpose timer timer mode is selected when ccsel = 0 and mod<3:0> = 0000 . the timer can function as a 32-bit timer or a dual 16-bit timer, depending on the setting of the t32 bit ( table 16-1 ). table 16-1: timer operation mode dual 16-bit timer mode provides a simple timer function with two independent 16-bit timer/counters. the primary timer uses the ccpxtmrl and ccpxprl registers. only the primary timer can interact with other modules on the device. it generates the mccpx sync out signals for use by other mccpx modules. it can also use the sync<4:0> bits signal generated by other modules. the secondary timer uses the ccpxtmrh and ccpxprh registers. it is intended to be used only as a periodic interrupt source for scheduling cpu events. it does not generate an output sync/trigger signal like the primary time base. in dual timer mode, the secondary timer period register, ccpxprh, generates the mccpx compare event (ccpxif) used by many other modules on the device. the 32-bit timer mode uses the ccpxtmrl and ccpxtmrh registers, together, as a single 32-bit timer. when ccpxtmrl overflows, ccpxtmrh increments by one. this mode provides a simple timer function when it is important to track long time periods. note that the t32 bit (ccpxcon1l<5>) should be set before the ccpxtmrl or ccpxprh registers are written to initialize the 32-bit timer. 16.2.1 sync and trigger operation in both 16-bit and 32-bit modes, the timer can also function in either synchronization (sync) or trigger mode operation. both use the sync<4:0> bits (ccpxcon1h<4:0>) to determine the input signal source. the difference is how that signal affects the timer. in sync operation, the timer reset or clear occurs when the input selected by sync<4:0> is asserted. the timer immediately begins to count again from zero unless it is held for some other reason. sync operation is used when- ever the trigen bit (ccpxcon1h<7>) is cleared. the sync<4:0> bits can have any value except 11111 . in trigger operation, the timer is held in reset until the input selected by sync<4:0> is asserted; when it occurs, the timer starts counting. trigger operation is used whenever the trigen bit is set. in trigger mode, the timer will continue running after a trigger event as long as the ccptrig bit (ccpxstatl< 7>) is set. to clear ccptrig, the trclr bit (ccpxstatl<5>) must be set to clear the trigger event, reset the timer and hold it at zero until another trigger event occurs. on pic24fj1024ga610/gb610 family devices, trigger operation can only be used when the system clock is the time base source (clksel<2:0> = 000 ). figure 16-3: dual 16-bit timer mode t32 (ccpxcon1l<5>) operating mode 0 dual timer mode (16-bit) 1 timer mode (32-bit) comparator ccpxtmrl ccpxprl ccpxrb ccpxtmrh ccpxprh comparator clock sources set cctxif special event trigger set ccpxif sync<4:0> time base generator sync/ trigger control comparator downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 210 ? 2015 microchip technology inc. figure 16-4: 32-bit timer mode 16.3 output compare mode output compare mode compares the timer register value with the value of one or two compare registers, depending on its mode of operation. the output compare x module, on compare match events, has the ability to generate a single output transition or a train of output pulses. like most pic ? mcu peripherals, the output compare x module can also generate interrupts on a compare match event. table 16-2 shows the various modes available in output compare modes. table 16-2: output compare/pwm modes ccpxtmrl ccpxprl comparator set cctxif ccpxtmrh ccpxprh clock sources sync/ trigger control sync<4:0> time base generator mod<3:0> (ccpxcon1l<3:0>) t32 (ccpxcon1l<5>) operating mode 0001 0 output high on compare (16-bit) single edge mode 0001 1 output high on compare (32-bit) 0010 0 output low on compare (16-bit) 0010 1 output low on compare (32-bit) 0011 0 output toggle on compare (16-bit) 0011 1 output toggle on compare (32-bit) 0100 0 dual edge compare (16-bit) dual edge mode 0101 0 dual edge compare (16-bit buffered) pwm mode 0110 0 center-aligned pulse (16-bit buffered) center pwm mode 0111 0 variable frequency pulse (16-bit) 1111 0 external input source mode (16-bit) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 211 pic24fj1024ga610/gb610 family figure 16-5: output compare x block diagram ccpxra buffer comparator ccpxcon1h/l ccpxcon2h/l ocx output, output compare ccpx pin(s) ccpxrb buffer comparator fault logic match match time base generator increment reset ocx clock sources trigger and sync sources reset match event ocfa/ocfb ccpxrah/l event event rollover rollover/reset rollover/reset ccpxcon3h/l auto-shutdown and polarity control edge detect interrupt comparator trigger and sync logic ccpxprl ccpxrbh/l ccpxtmrh/l downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 212 ? 2015 microchip technology inc. 16.4 input capture mode input capture mode is used to capture a timer value from an independent timer base upon an event on an input pin or other internal trigger source. the input capture features are useful in applications requiring frequency (time period) and pulse measurement. figure 16-6 depicts a simplified block diagram of the input capture mode. input capture mode uses a dedicated 16/32-bit, synchro- nous, up counting timer for the capture function. the timer value is written to the fifo when a capture event occurs. the internal value may be read (with a synchronization delay) using the ccpxtmrh/l registers. to use input capture mode, the ccsel bit (ccpxcon1l<4>) must be set. the t32 and mod<3:0> bits are used to select the proper capture mode, as shown in tab le 1 6- 3 . figure 16-6: input capture x block diagram table 16-3: input capture modes mod<3:0> (ccpxcon1l<3:0>) t32 (ccpxcon1l<5>) operating mode 0000 0 edge detect (16-bit capture) 0000 1 edge detect (32-bit capture) 0001 0 every rising (16-bit capture) 0001 1 every rising (32-bit capture) 0010 0 every falling (16-bit capture) 0010 1 every falling (32-bit capture) 0011 0 every rise/fall (16-bit capture) 0011 1 every rise/fall (32-bit capture) 0100 0 every 4th rising (16-bit capture) 0100 1 every 4th rising (32-bit capture) 0101 0 every 16th rising (16-bit capture) 0101 1 every 16th rising (32-bit capture) ccpxbufx 4-level fifo buffer mod<3:0> set ccpxif ops<3:0> interrupt logic system bus event and trigger and sync logic clock select icx clock sources trigger and sync sources ics<2:0> 16 16 16 ccpxtmrh/l increment reset t32 edge detect logic and clock synchronizer downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 213 pic24fj1024ga610/gb610 family 16.5 auxiliary output the mccpx and sccpx modules have an auxiliary (secondary) output that provides other peripherals access to internal module signals. the auxiliary output is intended to connect to other mccpx or sccpx modules, or other digital peripherals, to provide these types of functions: time base synchronization peripheral trigger and clock inputs signal gating the type of output signal is selected using the auxout<1:0> control bits (ccpxcon2h<4:3>). the type of output signal is also dependent on the module operating mode. on the pic24fj1024ga610/gb610 family of devices, only the ctmu discharge trigger has access to the auxiliary output signal. table 16-4: auxiliary output auxout<1:0> ccsel mod<3:0> comments signal description 00 x xxxx auxiliary output disabled no output 01 0 0000 time base modes time base period reset or rollover 10 special event trigger output 11 no output 01 0 0001 through 1111 output compare modes time base period reset or rollover 10 output compare event signal 11 output compare signal 01 1 xxxx input capture modes time base period reset or rollover 10 reflects the value of the icdis bit 11 input capture event signal downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 214 ? 2015 microchip technology inc. register 16-1: ccpxcon1l: ccpx control 1 low registers r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ccpon ccpsidl ccpslp tmrsync clksel2 clksel1 clksel0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 tmrps1 tmrps0 t32 ccsel mod3 mod2 mod1 mod0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 ccpon: ccpx module enable bit 1 = module is enabled with an operating mode specified by the mod<3:0> control bits 0 = module is disabled bit 14 unimplemented: read as 0 bit 13 ccpsidl: ccpx stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 ccpslp: ccpx sleep mode enable bit 1 = module continues to operate in sleep modes 0 = module does not operate in sleep modes bit 11 tmrsync: time base clock synchronization bit 1 = module time base clock is synchronized to the internal system clocks; timing restrictions apply 0 = module time base clock is not synchronized to the internal system clocks bit 10-8 clksel<2:0>: ccpx time base clock select bits 111 = tckia pin 110 = tckib pin 101 = pll clock 100 = 2x peripheral clock 010 = sosc clock 001 = reference clock output 000 = system clock for mccp1 and sccp4 : 011 = clc1 output for mccp2 and sccp5 : 011 = clc2 output for mccp3 and sccp6 : 011 = clc3 output for sccp7 : 011 = clc4 output bit 7-6 tmrps<1:0>: time base prescale select bits 11 = 1:64 prescaler 10 = 1:16 prescaler 01 = 1:4 prescaler 00 = 1:1 prescaler bit 5 t32: 32-bit time base select bit 1 = uses 32-bit time base for timer, single edge output compare or input capture function 0 = uses 16-bit time base for timer, single edge output compare or input capture function downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 215 pic24fj1024ga610/gb610 family bit 4 ccsel: capture/compare mode select bit 1 = input capture peripheral 0 = output compare/pwm/timer peripheral (exact function is selected by the mod<3:0> bits) bit 3-0 mod<3:0>: ccpx mode select bits for ccsel = 1 (input capture modes): 1xxx = reserved 011x = reserved 0101 = capture every 16th rising edge 0100 = capture every 4th rising edge 0011 = capture every rising and falling edge 0010 = capture every falling edge 0001 = capture every rising edge 0000 = capture every rising and falling edge (edge detect mode) for ccsel = 0 (output compare/timer modes): 1111 = external input mode: pulse generator is disabled, source is selected by ics<2:0> 1110 = reserved 110x = reserved 10xx = reserved 0111 = variable frequency pulse mode 0110 = center-aligned pulse compare mode, buffered 0101 = dual edge compare mode, buffered 0100 = dual edge compare mode 0011 = 16-bit/32-bit single edge mode, toggles output on compare match 0010 = 16-bit/32-bit single edge mode, drives output low on compare match 0001 = 16-bit/32-bit single edge mode, drives output high on compare match 0000 = 16-bit/32-bit timer mode, output functions are disabled register 16-1: ccpxcon1l: ccpx cont rol 1 low registers (continued) downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 216 ? 2015 microchip technology inc. register 16-2: ccpxcon1h: ccpx control 1 high registers r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 opssrc ( 1 ) rtrgen ( 2 ) ops3 ( 3 ) ops2 ( 3 ) ops1 ( 3 ) ops0 ( 3 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 trigen oneshot altsync sync4 sync3 sync2 sync1 sync0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 opssrc: output postscaler source select bit ( 1 ) 1 = output postscaler scales module trigger output events 0 = output postscaler scales time base interrupt events bit 14 rtrgen: retrigger enable bit ( 2 ) 1 = time base can be retriggered when trigen bit = 1 0 = time base may not be retriggered when trigen bit = 1 bit 13-12 unimplemented: read as 0 bit 11-8 ops3<3:0>: ccpx interrupt output postscale select bits ( 3 ) 1111 = interrupt every 16th time base period match 1110 = interrupt every 15th time base period match . . . 0100 = interrupt every 5th time base period match 0011 = interrupt every 4th time base period match or 4th input capture event 0010 = interrupt every 3rd time base period match or 3rd input capture event 0001 = interrupt every 2nd time base period match or 2nd input capture event 0000 = interrupt after each time base period match or input capture event bit 7 trigen: ccpx trigger enable bit 1 = trigger operation of time base is enabled 0 = trigger operation of time base is disabled bit 6 oneshot: one-shot mode enable bit 1 = one-shot trigger mode is enabled; trigger duration is set by oscnt<2:0> 0 = one-shot trigger mode is disabled bit 5 altsync: ccpx clock select bit 1 = an alternate signal is used as the module synchronization output signal 0 = the module synchronization output signal is the time base reset/rollover event bit 4-0 sync<4:0>: ccpx synchronization source select bits see table 16-5 for the definition of inputs. note 1: this control bit has no function in input capture modes. 2: this control bit has no function when trigen = 0 . 3: output postscale settings, from 1:5 to 1:16 ( 0100 - 1111 ), will result in a fifo buffer overflow for input capture modes. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 217 pic24fj1024ga610/gb610 family table 16-5: synchronization sources sync<4:0> synchronization source 11111 none; timer with rollover on ccpxpr match or ffffh 11110 reserved 11101 reserved 11100 ctmu trigger 11011 a/d start conversion 11010 cmp3 trigger 11001 cmp2 trigger 11000 cmp1 trigger 10111 reserved 10110 reserved 10101 reserved 10100 reserved 10011 clc4 out 10010 clc3 out 10001 clc2 out 10000 clc1 out 01111 reserved 01110 reserved 01101 reserved 01100 reserved 01011 int2 pad 01010 int1 pad 01001 int0 pad 01000 sccp7 sync out 00111 sccp6 sync out 00110 sccp5 sync out 00101 sccp4 sync out 00100 mccp3 sync out 00011 mccp2 sync out 00010 mccp1 sync out 00001 mccpx/sccpx sync out ( 1 ) 00000 mccpx/sccpx timer sync out ( 1 ) note 1: ccp1 when connected to ccp1, ccp2 when connected to ccp2, etc. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 218 ? 2015 microchip technology inc. table 16-6: auto-shutdown sources register 16-3: ccpxcon2l: ccpx control 2 low registers r/w-0 r/w-0 u-0 r/w-0 u-0 u-0 u-0 u-0 pwmrsen asdgm ssdg bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 asdg7 asdg6 asdg5 asdg4 asdg3 asdg2 asdg1 asdg0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 pwmrsen: ccpx pwm restart enable bit 1 = asevt bit clears automatically at the beginning of the next pwm period, after the shutdown input has ended 0 = asevt bit must be cleared in software to resume pwm activity on output pins bit 14 asdgm: ccpx auto-shutdown gate mode enable bit 1 = waits until the next time base reset or rollover for shutdown to occur 0 = shutdown event occurs immediately bit 13 unimplemented: read as 0 bit 12 ssdg: ccpx software shutdown/gate control bit 1 = manually forces auto-shutdown, timer clock gate or input capture signal gate event (setting of asdgm bit still applies) 0 = normal module operation bit 11-8 unimplemented: read as 0 bit 7-0 asdg<7:0>: ccpx auto-shutdown/gating source enable bits 1 = asdgx source n is enabled (see tab l e 1 6- 6 for auto-shutdown/gating sources) 0 = asdgx source n is disabled asdg<7:0> auto-shutdown source mccp1 mccp2 mccp3 sccp4 sccp5 sccp6 sccp7 1xxx xxxx ocfb x1xx xxxx ocfa xx1x xxxx clc1 clc2 clc3 clc1 clc2 clc3 clc4 xxx1 xxxx sccp4 oc out mccp1 oc out xxxx 1xxx sccp5 oc out mccp2 oc out xxxx x1xx cmp3 out xxxx xx1x cmp2 out xxxx xxx1 cmp1 out downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 219 pic24fj1024ga610/gb610 family register 16-4: ccpxcon2h: ccpx control 2 high registers r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-1 oensync o c f e n ( 1 , 2 ) oceen ( 1 , 2 ) ocden ( 1 , 2 ) occen ( 1 , 2 ) ocben ( 1 ) ocaen bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 icgsm1 icgsm0 auxout1 auxout0 ics2 ics1 ics0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 oensync: output enable synchronization bit 1 = update by output enable bits occurs on the next time base reset or rollover 0 = update by output enable bits occurs immediately bit 14 unimplemented: read as 0 bit 13-8 ocxen: output enable/steering control bits ( 1 , 2 ) 1 = ocmx pin is controlled by the ccpx module and produces an output compare or pwm signal 0 = ocmx pin is not controlled by the ccpx module; the pin is available to the port logic or another peripheral multiplexed on the pin bit 7-6 icgsm<1:0>: input capture gating source mode control bits 11 = reserved 10 = one-shot mode: falling edge from gating source disables future capture events (icdis = 1 ) 01 = one-shot mode: rising edge from gating source enables future capture events (icdis = 0 ) 00 = level-sensitive mode: a high level from gating source will enable future capture events; a low level will disable future capture events bit 5 unimplemented: read as 0 bit 4-3 auxout<1:0>: auxiliary output signal on event selection bits 11 = input capture or output compare event; no signal in timer mode 10 = signal output is defined by module operating mode (see table 16-4 ) 01 = time base rollover event (all modes) 00 =disabled bit 2-0 ics<2:0>: input capture source select bits 111 = clc4 output 110 = clc3 output 101 = clc2 output 100 = clc1 output 011 = comparator 3 output 010 = comparator 2 output 001 = comparator 1 output 000 = input capture x (icmx) i/o pin note 1: ocfen through ocben (bits<13:9>) are implemented in mccpx modules only. 2: ocfen through occen (bits<13:10>) are not available on 64-pin parts. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 220 ? 2015 microchip technology inc. register 16-5: ccpxcon3l: ccpx control 3 low registers ( 1 ) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 d t < 5 : 0 > bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as 0 bit 5-0 dt<5:0>: ccpx dead-time select bits 111111 = inserts 63 dead-time delay periods between complementary output signals 111110 = inserts 62 dead-time delay periods between complementary output signals . . . 000010 = inserts 2 dead-time delay periods between complementary output signals 000001 = inserts 1 dead-time delay period between complementary output signals 000000 = dead-time logic is disabled note 1: this register is implemented in mccpx modules only. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 221 pic24fj1024ga610/gb610 family register 16-6: ccpxcon3h: ccpx control 3 high registers r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 oetrig oscnt2 oscnt1 oscnt0 o u t m 2 ( 1 ) outm1 ( 1 ) outm0 ( 1 ) bit 15 bit 8 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 p o l a c e p o l b d f ( 1 ) pssace1 pssace0 pssbdf1 ( 1 ) pssbdf0 ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 oetrig: ccpx dead-time select bit 1 = for triggered mode (trigen = 1 ): module does not drive enabled output pins until triggered 0 = normal output pin operation bit 14-12 oscnt<2:0>: one-shot event count bits 111 = extends one-shot event by 7 time base periods (8 time base periods total) 110 = extends one-shot event by 6 time base periods (7 time base periods total) 101 = extends one-shot event by 5 time base periods (6 time base periods total) 100 = extends one-shot event by 4 time base periods (5 time base periods total) 011 = extends one-shot event by 3 time base periods (4 time base periods total) 010 = extends one-shot event by 2 time base periods (3 time base periods total) 001 = extends one-shot event by 1 time base period (2 time base periods total) 000 = does not extend one-shot trigger event bit 11 unimplemented: read as 0 bit 10-8 outm<2:0>: pwmx output mode control bits ( 1 ) 111 = reserved 110 = output scan mode 101 = brush dc output mode, forward 100 = brush dc output mode, reverse 011 = reserved 010 = half-bridge output mode 001 = push-pull output mode 000 = steerable single output mode bit 7-6 unimplemented: read as 0 bit 5 polace: ccpx output pins, ocmxa, ocmxc and ocmxe, polarity control bit 1 = output pin polarity is active-low 0 = output pin polarity is active-high bit 4 polbdf: ccpx output pins, ocmxb, ocmxd and ocmxf, polarity control bit ( 1 ) 1 = output pin polarity is active-low 0 = output pin polarity is active-high bit 3-2 pssace<1:0>: pwmx output pins, ocmxa, ocmxc and ocmxe, shutdown state control bits 11 = pins are driven active when a shutdown event occurs 10 = pins are driven inactive when a shutdown event occurs 0x = pins are tri-stated when a shutdown event occurs bit 1-0 pssbdf<1:0>: pwmx output pins, ocmxb, ocmxd, and ocmxf, shutdown state control bits ( 1 ) 11 = pins are driven active when a shutdown event occurs 10 = pins are driven inactive when a shutdown event occurs 0x = pins are in a high-impedance state when a shutdown event occurs note 1: these bits are implemented in mccpx modules only. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 222 ? 2015 microchip technology inc. register 16-7: ccpxstatl: ccpx status register low u-0 u-0 u-0 u-0 u-0 w-0 u-0 u-0 i c g a r m bit 15 bit 8 r-0 w1-0 w1-0 r/c-0 r/c-0 r/c-0 r/c-0 r/c-0 ccptrig trset trclr asevt scevt icdis icov icbne bit 7 bit 0 legend: c = clearable bit w = writable bit r = readable bit w1 = write 1 only bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as 0 bit 10 icgarm: input capture gate arm bit a write of 1 to this location will arm the input capture x module for a one-shot gating event when icgsm<1:0> = 01 or 10 ; read as 0 . bit 9-8 unimplemented: read as 0 bit 7 ccptrig: ccpx trigger status bit 1 = timer has been triggered and is running 0 = timer has not been triggered and is held in reset bit 6 trset: ccpx trigger set request bit write 1 to this location to trigger the timer when trigen = 1 (location always reads as 0 ). bit 5 trclr: ccpx trigger clear request bit write 1 to this location to cancel the timer trigger when trigen = 1 (location always reads as 0 ). bit 4 asevt: ccpx auto-shutdown event status/control bit 1 = a shutdown event is in progress; ccpx outputs are in the shutdown state 0 = ccpx outputs operate normally bit 3 scevt: single edge compare event status bit 1 = a single edge compare event has occurred 0 = a single edge compare event has not occurred bit 2 icdis: input capture x disable bit 1 = event on input capture x pin (icmx) does not generate a capture event 0 = event on input capture x pin will generate a capture event bit 1 icov: input capture x buffer overflow status bit 1 = the input capture x fifo buffer has overflowed 0 = the input capture x fifo buffer has not overflowed bit 0 icbne: input capture x buffer status bit 1 = input capture x buffer has data available 0 = input capture x buffer is empty downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 223 pic24fj1024ga610/gb610 family register 16-8: ccpxstath: ccpx status register high u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 r-0 r-0 r-0 r-0 r-0 prlwip tmrhwip tmrlwip rbwip rawip bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-5 unimplemented: read as 0 bit 4 prlwip: ccpxprl write in progress status bit 1 = an update to the ccpxprl register with the buffered contents is in progress 0 = an update to the ccpxprl register is not in progress bit 3 tmrhwip: ccpxtmrh write in progress status bit 1 = an update to the ccpxtmrh register with the buffered contents is in progress 0 = an update to the ccpxtmrh register is not in progress. bit 2 tmrlwip: ccpxtmrl write in progress status bit 1 = an update to the ccpxtmrl register with the buffered contents is in progress 0 = an update to the ccpxtmrl register is not in progress bit 1 rbwip: ccpxrb write in progress status bit 1 = an update to the ccpxrb register with the buffered contents is in progress 0 = an update to the ccpxrb register is not in progress bit 0 rawip: ccpxra write in progress status bit 1 = an update to the ccpxra register with the buffered contents is in progress 0 = an update to the ccpxra register is not in progress downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 224 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 225 pic24fj1024ga610/gb610 family 17.0 serial peripheral interface (spi) the serial peripheral interface (spi) module is a synchronous serial interface useful for communicating with other peripheral or microcontroller devices. these peripheral devices may be serial eeproms, shift registers, display drivers, a/d converters, etc. the spi module is compatible with the motorola ? spi and siop interfaces. all devices in the pic24fj1024ga610/ gb610 family include three spi modules. the module supports operation in two buffer modes. in standard mode, data is shifted through a single serial buffer. in enhanced buffer mode, data is shifted through a fifo buffer. the fifo level depends on the configured mode. variable length data can be transmitted and received from 2 to 32 bits. the module also supports a basic framed spi protocol while operating in either master or slave mode. a total of four framed spi configurations are supported. the module also supports audio modes. four different audio modes are available. i 2 s mode left justified right justified pcm/dsp in each of these modes, the serial clock is free-running and audio data is always transferred. if an audio protocol data transfer takes place between two devices, then usually one device is the master and the other is the slave. however, audio data can be transferred between two slaves. because the audio protocols require free-running clocks, the master can be a third party controller. in either case, the master generates two free-running clocks: sckx and lrc (left, right channel clock/ssx /fsync). the spi serial interface consists of four pins: sdix: serial data input sdox: serial data output sckx: shift clock input or output ssx : active-low slave select or frame synchronization i/o pulse the spi module can be configured to operate using 2, 3 or 4 pins. in the 3-pin mode, ssx is not used. in the 2-pin mode, both sdox and ssx are not used. the spi module has the ability to generate three inter- rupts reflecting the events that occur during the data communication. the following types of interrupts can be generated: 1. receive interrupts are signalled by spixrxif. this event occurs when: - rx watermark interrupt - spirov = 1 - spirbf = 1 - spirbe = 1 provided the respective mask bits are enabled in spiximskl/h. 2. transmit interrupts are signalled by spixtxif. this event occurs when: - tx watermark interrupt - spitur = 1 - spitbf = 1 - spitbe = 1 provided the respective mask bits are enabled in spiximskl/h. 3. general interrupts are signalled by spixif. this event occurs when - frmerr = 1 - spibusy = 1 -srmt = 1 provided the respective mask bits are enabled in spiximskl/h. a block diagram of the module in enhanced buffer mode is shown in figure 17-1 . note: this data sheet summarizes the features of the pic24fj1024ga610/gb610 family of devices. it is not intended to be a comprehensive reference source. to complement the information in this data sheet, refer to the dspic33/pic24 family reference manual , serial peripheral interface (spi) (ds70005185), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. note: do not perform read-modify-write opera- tions (such as bit-oriented instructions) on the spixbuf register in either standard or enhanced buffer mode. note: in this section, the spi modules are referred to together as spix, or separately as spi1, spi2 or spi3. special function registers will follow a similar notation. for example, spixcon1 and spixcon2 refer to the control registers for any of the three spi modules. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 226 ? 2015 microchip technology inc. 17.1 master mode operation perform the following steps to set up the spix module for master mode operation: 1. disable the spix interrupts in the respective iecx register. 2. stop and reset the spix module by clearing the spien bit. 3. clear the receive buffer. 4. clear the enhbuf bit (spixcon1l<0>) if using standard buffer mode or set the bit if using enhanced buffer mode. 5. if spix interrupts are not going to be used, skip this step. otherwise, the following additional steps are performed: a) clear the spix interrupt flags/events in the respective ifsx register. b) write the spix interrupt priority and sub-priority bits in the respective ipcx register. c) set the spix interrupt enable bits in the respective iecx register. 6. write the baud rate register, spixbrgl. 7. clear the spirov bit (spixstatl<6>). 8. write the desired settings to the spixcon1l register with msten (spixcon1l<5>) = 1 . 9. enable spi operation by setting the spien bit (spixcon1l<15>). 10. write the data to be transmitted to the spixbufl and spixbufh registers. transmis- sion (and reception) will start as soon as data is written to the spixbufl/h registers. 17.2 slave mode operation the following steps are used to set up the spix module for the slave mode of operation: 1. if using interrupts, disable the spix interrupts in the respective iecx register. 2. stop and reset the spix module by clearing the spien bit. 3. clear the receive buffer. 4. clear the enhbuf bit (spixcon1l<0>) if using standard buffer mode or set the bit if using enhanced buffer mode. 5. if using interrupts, the following additional steps are performed: a) clear the spix interrupt flags/events in the respective ifsx register. b) write the spix interrupt priority and sub- priority bits in the respective ipcx register. c) set the spix interrupt enable bits in the respective iecx register. 6. clear the spirov bit (spixstatl<6>). 7. write the desired settings to the spixcon1l register with msten (spixcon1l<5>) = 0 . 8. enable spi operation by setting the spien bit (spixcon1l<15>). 9. transmission (and reception) will start as soon as the master provides the serial clock. the following additional features are provided in slave mode: slave select synchronization: the ssx pin allows a synchronous slave mode. if the ssen bit (spixcon1l<7>) is set, transmis- sion and reception are enabled in slave mode only if the ssx pin is driven to a low state. the port output or other peripheral outputs must not be driven in order to allow the ssx pin to function as an input. if the ssen bit is set and the ssx pin is driven high, the sdox pin is no longer driven and will tri-state, even if the module is in the middle of a transmission. an aborted transmission will be tried again the next time the ssx pin is driven low using the data held in the spixtxb register. if the ssen bit is not set, the ssx pin does not affect the module operation in slave mode. spitbe status flag operation: the spitbe bit (spixstatl<3>) has a different function in the slave mode of operation. the following describes the function of spitbe for various settings of the slave mode of operation: - if ssen (spixcon1l<7>) is cleared, the spitbe bit is cleared when spixbuf is loaded by the user code. it is set when the module transfers spixtxb to spixtxsr. this is similar to the spitbe bit function in master mode. - if ssen is set, spitbe is cleared when spixbuf is loaded by the user code. how- ever, it is set only when the spix module completes data transmission. a transmission will be aborted when the ssx pin goes high and may be retried at a later time. so, each data word is held in spixtxb until all bits are transmitted to the receiver. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 227 pic24fj1024ga610/gb610 family figure 17-1: spix module bl ock diagram (enhanced mode) 17.3 audio mode operation to initialize the spix module for audio mode, follow the steps to initialize it for master/slave mode, but also set the auden bit (spixcon1h<15>). in master+audio mode: this mode enables the device to generate sckx and lrc pulses as long as the spien bit (spixcon1l<15>) = 1 . the spix module generates lrc and sckx continuously in all cases, regardless of the transmit data, while in master mode. the spix module drives the leading edge of lrc and sckx within 1 sckx period, and the serial data shifts in and out continuously, even when the tx fifo is empty. in slave+audio mode: this mode enables the device to receive sckx and lrc pulses as long as the spien bit (spixcon1l<15>) = 1 . the spix module drives zeros out of sdox, but does not shift data out or in (sdix) until the module receives the lrc (i.e., the edge that precedes the left channel). once the module receives the leading edge of lrc, it starts receiving data if dissdi (spixcon1l<4>) = 0 and the serial data shifts out continuously, even when the tx fifo is empty. read write internal data bus sdix sdox ssx /fsync sckx msb shift control edge select enable master clock transmit pbclk mclk mclken spixrxsr urdten 1 0 txelm<5:0> = 6b0 msb baud rate generator ssx & fsync control clock control spixtxsr clock control receive spixurdt spixtxb edge select spixrxb downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 228 ? 2015 microchip technology inc. 17.4 spi control registers register 17-1: spixcon1l: spix control register 1 low r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 spien spisidl dissdo mode32 ( 1,4 ) mode16 ( 1,4 ) smp cke ( 1 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ssen ( 2 ) ckp msten dissdi dissck mclken ( 3 ) spife enhbuf bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 spien: spix on bit 1 = enables module 0 = turns off and resets module, disables clocks, disables interrupt event generation, allows sfr modifications bit 14 unimplemented: read as 0 bit 13 spisidl: spix stop in idle mode bit 1 = halts in cpu idle mode 0 = continues to operate in cpu idle mode bit 12 dissdo: disable sdox output port bit 1 = sdox pin is not used by the module; pin is controlled by the port function 0 = sdox pin is controlled by the module bit 11-10 mode<32,16>: serial word length bits ( 1,4 ) auden = 0 : mode32 mode16 communication 1x 32-bit 01 16-bit 00 8-bit auden = 1 : mode32 mode16 communication 11 24-bit data, 32-bit fifo, 32-bit channel/64-bit frame 10 32-bit data, 32-bit fifo, 32-bit channel/64-bit frame 01 16-bit data, 16-bit fifo, 32-bit channel/64-bit frame 00 16-bit data, 16-bit fifo, 16-bit channel/32-bit frame bit 9 smp: spix data input sample phase bit master mode: 1 = input data is sampled at the end of data output time 0 = input data is sampled at the middle of data output time slave mode: input data is always sampled at the middle of data output time, regardless of the smp setting. note 1: when auden = 1 , this module functions as if cke = 0 , regardless of its actual value. 2: when frmen = 1 , ssen is not used. 3: mclken can only be written when the spien bit = 0 . 4: this channel is not meaningful for dsp/pcm mode as lrc follows the frmsypw bit. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 229 pic24fj1024ga610/gb610 family bit 8 cke: spix clock edge select bit ( 1 ) 1 = transmit happens on transition from active clock state to idle clock state 0 = transmit happens on transition from idle clock state to active clock state bit 7 ssen: slave select enable bit (slave mode) ( 2 ) 1 = ssx pin is used by the macro in slave mode; ssx pin is used as the slave select input 0 = ssx pin is not used by the macro (ssx pin will be controlled by the port i/o) bit 6 ckp: spix clock polarity select bit 1 = idle state for clock is a high level; active state is a low level 0 = idle state for clock is a low level; active state is a high level bit 5 msten: master mode enable bit 1 = master mode 0 = slave mode bit 4 dissdi: disable sdix input port bit 1 = sdix pin is not used by the module; pin is controlled by the port function 0 = sdix pin is controlled by the module bit 3 dissck: disable sckx output port bit 1 = sckx pin is not used by the module; pin is controlled by the port function 0 = sckx pin is controlled by the module bit 2 mclken: master clock enable bit ( 3 ) 1 = mclk is used by the brg 0 = pbclk is used by the brg bit 1 spife: frame sync pulse edge select bit 1 = frame sync pulse (idle-to-active edge) coincides with the first bit clock 0 = frame sync pulse (idle-to-active edge) precedes the first bit clock bit 0 enhbuf: enhanced buffer mode enable bit 1 = enhanced buffer mode is enabled 0 = enhanced buffer mode is disabled register 17-1: spixcon1l: spix control register 1 low (continued) note 1: when auden = 1 , this module functions as if cke = 0 , regardless of its actual value. 2: when frmen = 1 , ssen is not used. 3: mclken can only be written when the spien bit = 0 . 4: this channel is not meaningful for dsp/pcm mode as lrc follows the frmsypw bit. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 230 ? 2015 microchip technology inc. register 17-2: spixcon1h: spix control register 1 high r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 auden ( 1 ) spisgnext ignrov igntur audmono ( 2 ) urdten ( 3 ) audmod1 ( 4 ) audmod0 ( 4 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 frmen frmsync frmpol mssen frmsypw frmcnt2 frmcnt1 frmcnt0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 auden: audio codec support enable bit ( 1 ) 1 = audio protocol is enabled; msten controls the direction of both the sckx and frame (a.k.a. lrc), and this module functions as if frmen = 1 , frmsync = msten, frmcnt<2:0> = 001 and smp = 0 , regardless of their actual values 0 = audio protocol is disabled bit 14 spisgnext: spix sign-extend rx fifo read data enable bit 1 = data from rx fifo is sign-extended 0 = data from rx fifo is not sign-extended bit 13 ignrov: ignore receive overflow bit 1 = a receive overflow (rov) is not a critical error; during rov, data in the fifo is not overwritten by the receive data 0 = a rov is a critical error that stops spi operation bit 12 igntur: ignore transmit underrun bit 1 = a transmit underrun (tur) is not a critical error and data indicated by urdten i s transmitted until the spixtxb is not empty 0 = a tur is a critical error that stops spi operation bit 11 audmono: audio data format transmit bit ( 2 ) 1 = audio data is mono (i.e., each data word is transmitted on both left and right channels) 0 = audio data is stereo bit 10 urdten: transmit underrun data enable bit ( 3 ) 1 = transmits data out of spixurdtl/h register during transmit underrun conditions 0 = transmits the last received data during transmit underrun conditions bit 9-8 audmod<1:0>: audio protocol mode selection bits ( 4 ) 11 = pcm/dsp mode 10 = right justified mode: this module functions as if spife = 1 , regardless of its actual value 01 = left justified mode: this module functions as if spife = 1 , regardless of its actual value 00 = i 2 s mode: this module functions as if spife = 0 , regardless of its actual value bit 7 frmen: framed spix support bit 1 = framed spix support is enabled (ssx pin is used as the fsync input/output) 0 = framed spix support is disabled note 1: auden can only be written when the spien bit = 0 . 2: audmono can only be written when the spien bit = 0 and is only valid for auden = 1 . 3: urdten is only valid when igntur = 1 . 4: audmod<1:0> bits can only be written when the spien bit = 0 and are only valid when auden = 1 . when not in pcm/dsp mode, this module functions as if frmsypw = 1 , regardless of its actual value. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 231 pic24fj1024ga610/gb610 family bit 6 frmsync: frame sync pulse direction control bit 1 = frame sync pulse input (slave) 0 = frame sync pulse output (master) bit 5 frmpol: frame sync/slave select polarity bit 1 = frame sync pulse/slave select is active-high 0 = frame sync pulse/slave select is active-low bit 4 mssen: master mode slave select enable bit 1 = spix slave select support is enabled with polarity determined by frmpol (ssx pin is automatically driven during transmission in master mode) 0 = spix slave select support is disabled (ssx pin will be controlled by port io) bit 3 frmsypw: frame sync pulse-width bit 1 = frame sync pulse is one serial word length wide (as defined by mode<32,16>/wlength<4:0>) 0 = frame sync pulse is one clock (sck) wide bit 2-0 frmcnt<2:0>: frame sync pulse counter bits controls the number of serial words transmitted per sync pulse. 111 = reserved 110 = reserved 101 = generates a frame sync pulse on every 32 serial words 100 = generates a frame sync pulse on every 16 serial words 011 = generates a frame sync pulse on every 8 serial words 010 = generates a frame sync pulse on every 4 serial words 001 = generates a frame sync pulse on every 2 serial words (value used by audio protocols) 000 = generates a frame sync pulse on each serial word register 17-2: spixcon1h: spix control register 1 high (continued) note 1: auden can only be written when the spien bit = 0 . 2: audmono can only be written when the spien bit = 0 and is only valid for auden = 1 . 3: urdten is only valid when igntur = 1 . 4: audmod<1:0> bits can only be written when the spien bit = 0 and are only valid when auden = 1 . when not in pcm/dsp mode, this module functions as if frmsypw = 1 , regardless of its actual value. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 232 ? 2015 microchip technology inc. register 17-3: spixcon2l: spix control register 2 low u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 wlength<4:0> ( 1,2 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-5 unimplemented: read as 0 bit 4-0 wlength<4:0>: variable word length bits ( 1,2 ) 11111 = 32-bit data 11110 = 31-bit data 11101 = 30-bit data 11100 = 29-bit data 11011 = 28-bit data 11010 = 27-bit data 11001 = 26-bit data 11000 = 25-bit data 10111 = 24-bit data 10110 = 23-bit data 10101 = 22-bit data 10100 = 21-bit data 10011 = 20-bit data 10010 = 19-bit data 10001 = 18-bit data 10000 = 17-bit data 01111 = 16-bit data 01110 = 15-bit data 01101 = 14-bit data 01100 = 13-bit data 01011 = 12-bit data 01010 = 11-bit data 01001 = 10-bit data 01000 = 9-bit data 00111 = 8-bit data 00110 = 7-bit data 00101 = 6-bit data 00100 = 5-bit data 00011 = 4-bit data 00010 = 3-bit data 00001 = 2-bit data 00000 = see mode<32,16> bits in spixcon1l<11:10> note 1: these bits are effective when auden = 0 only. 2: varying the length by changing these bits does not affect the depth of the tx/rx fifo. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 233 pic24fj1024ga610/gb610 family register 17-4: spixstatl: spix status register low u-0 u-0 u-0 r/c-0, hs r-0, hsc u-0 u-0 r-0, hsc frmerr spibusy spitur ( 1 ) bit 15 bit 8 r-0, hsc r/c-0, hs r-1, hsc u-0 r-1, hsc u-0 r-0, hsc r-0, hsc srmt spirov spirbe spitbe spitbf spirbf bit 7 bit 0 legend: c = clearable bit hs = hardware settable bit x = bit is unknown r = readable bit w = writable bit 0 = bit is cleared hsc = hardware settable/clearable bit -n = value at por 1 = bit is set u = unimplemented bit, read as 0 bit 15-13 unimplemented: read as 0 bit 12 frmerr : spix frame error status bit 1 = frame error is detected 0 = no frame error is detected bit 11 spibusy: spix activity status bit 1 = module is currently busy with some transactions 0 = no ongoing transactions (at time of read) bit 10-9 unimplemented: read as 0 bit 8 spitur: spix transmit underrun status bit ( 1 ) 1 = transmit buffer has encountered a transmit underrun condition 0 = transmit buffer does not have a transmit underrun condition bit 7 srmt: shift register empty status bit 1 = no current or pending transactions (i.e., neither spixtxb or spixtxsr contains data to transmit) 0 = current or pending transactions bit 6 spirov: spix receive overflow status bit 1 = a new byte/half-word/word has been completely received when the spixrxb is full 0 = no overflow bit 5 spirbe: spix rx buffer empty status bit 1 = rx buffer is empty 0 = rx buffer is not empty standard buffer mode: automatically set in hardware when spixbuf is read from, reading spixrxb. automatically cleared in hardware when spix transfers data from spixrxsr to spixrxb. enhanced buffer mode: indicates rxelm<5:0> = 6b000000 . bit 4 unimplemented: read as 0 bit 3 spitbe: spix transmit buffer empty status bit 1 = spixtxb is empty 0 = spixtxb is not empty standard buffer mode: automatically set in hardware when spix transfers data from spixtxb to spixtxsr. automatically cleared in hardware when spixbuf is written, loading spixtxb. enhanced buffer mode: indicates txelm<5:0> = 6b000000 . note 1: spitur is cleared when spien = 0 . when igntur = 1 , spitur provides dynamic status of the transmit underrun condition, but does not stop rx/tx operation and does not need to be cleared by software. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 234 ? 2015 microchip technology inc. bit 2 unimplemented: read as 0 bit 1 spitbf: spix transmit buffer full status bit 1 = spixtxb is full 0 = spixtxb not full standard buffer mode: automatically set in hardware when spixbuf is written, loading spixt xb. automatically cleared in hardware when spix transfers data from spixtxb to spixtxsr. enhanced buffer mode: indicates txelm<5:0> = 6b111111 . bit 0 spirbf: spix receive buffer full status bit 1 = spixrxb is full 0 = spixrxb is not full standard buffer mode: automatically set in hardware when spix transfers data from spixrxsr to spixrxb. automatically cleared in hardware when spixbuf is read from, reading spixrxb. enhanced buffer mode: indicates rxelm<5:0> = 6b111111 . register 17-4: spixstatl: spix status register low (continued) note 1: spitur is cleared when spien = 0 . when igntur = 1 , spitur provides dynamic status of the transmit underrun condition, but does not stop rx/tx operation and does not need to be cleared by software. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 235 pic24fj1024ga610/gb610 family register 17-5: spixstath: spix status register high u-0 u-0 r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc r x e l m 5 ( 3 ) rxelm4 ( 2 ) rxelm3 ( 1 ) rxelm2 rxelm1 rxelm0 bit 15 bit 8 u-0 u-0 r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc txelm5 ( 3 ) txelm4 ( 2 ) txelm3 ( 1 ) txelm2 txelm1 txelm0 bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-8 rxelm<5:0>: receive buffer element count bits (valid in enhanced buffer mode) ( 1 , 2 , 3 ) bit 7-6 unimplemented: read as 0 bit 5-0 txelm<5:0>: transmit buffer element count bits (valid in enhanced buffer mode) ( 1 , 2 , 3 ) note 1: rxelm3 and txelm3 bits are only present when fifodepth = 8 or higher. 2: rxelm4 and txelm4 bits are only present when fifodepth = 16 or higher. 3: rxelm5 and txelm5 bits are only present when fifodepth = 32. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 236 ? 2015 microchip technology inc. register 17-6: spixbufl: spix buffer register low r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 data<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 data<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 data<15:0>: spix fifo data bits when the mode<32,16> or wlength<4:0> bits select 16 to 9-bit data, the spix only uses data<15:0>. when the mode<32,16> or wlength<4:0> bits select 8 to 2-bit data, the spix only uses data<7:0>. register 17-7: spixbufh: spix buffer register high r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 data<31:24> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 data<23:16> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 data<31:16>: spix fifo data bits when the mode<32,16> or wlength<4:0> bits select 32 to 25-bit data, the spix uses data<31:16 >. when the mode<32,16> or wlength<4:0> bits select 24 to 17-bit data, the spix only uses data<23:16>. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 237 pic24fj1024ga610/gb610 family register 17-8: spixbrgl: spix baud rate generator register low u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 b r g < 1 2 : 8 > ( 1 ) bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 brg<7:0> ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-13 unimplemented: read as 0 bit 12-0 brg<12:0>: spix baud rate generator divisor bits ( 1 ) note 1: changing the brg value when spien = 1 causes undefined behavior. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 238 ? 2015 microchip technology inc. register 17-9: spiximskl: spix interrupt mask register low u-0 u-0 u-0 r/w-0 r/w-0 u-0 u-0 r/w-0 frmerren busyen spituren bit 15 bit 8 r/w-0 r/w-0 r/w-0 u-0 r/w-0 u-0 r/w-0 r/w-0 srmten spiroven spirben spitben spitbfen spirbfen bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-13 unimplemented: read as 0 bit 12 frmerren: enable interrupt events via frmerr bit 1 = frame error generates an interrupt event 0 = frame error does not generate an interrupt event bit 11 busyen: enable interrupt events via spibusy bit 1 = spibusy generates an interrupt event 0 = spibusy does not generate an interrupt event bit 10-9 unimplemented: read as 0 bit 8 spituren: enable interrupt events via spitur bit 1 = transmit underrun (tur) generates an interrupt event 0 = transmit underrun does not generate an interrupt event bit 7 srmten: enable interrupt events via srmt bit 1 = shift register empty (srmt) generates interrupt events 0 = shift register empty does not generate interrupt events bit 6 spiroven: enable interrupt events via spirov bit 1 = spix receive overflow generates an interrupt event 0 = spix receive overflow does not generate an interrupt event bit 5 spirben: enable interrupt events via spirbe bit 1 = spix rx buffer empty generates an interrupt event 0 = spix rx buffer empty does not generate an interrupt event bit 4 unimplemented: read as 0 bit 3 spitben: enable interrupt events via spitbe bit 1 = spix transmit buffer empty generates an interrupt event 0 = spix transmit buffer empty does not generate an interrupt event bit 2 unimplemented: read as 0 bit 1 spitbfen: enable interrupt events via spitbf bit 1 = spix transmit buffer full generates an interrupt event 0 = spix transmit buffer full does not generate an interrupt event bit 0 spirbfen: enable interrupt events via spirbf bit 1 = spix receive buffer full generates an interrupt event 0 = spix receive buffer full does not generate an interrupt event downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 239 pic24fj1024ga610/gb610 family register 17-10: spiximskh: spix interrupt mask register high r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 rxwien rxmsk5 ( 1 ) rxmsk4 ( 1 , 4 ) rxmsk3 ( 1 , 3 ) rxmsk2 ( 1 , 2 ) rxmsk1 ( 1 ) rxmsk0 ( 1 ) bit 15 bit 8 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 txwien t x m s k 5 ( 1 ) txmsk4 ( 1 , 4 ) txmsk3 ( 1 , 3 ) txmsk2 ( 1 , 2 ) txmsk1 ( 1 ) txmsk0 ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 rxwien: receive watermark interrupt enable bit 1 = triggers receive buffer element watermark interrupt when rxmsk<5:0> ? rxelm<5:0> 0 = disables receive buffer element watermark interrupt bit 14 unimplemented: read as 0 bit 13-8 rxmsk<5:0>: rx buffer mask bits ( 1 , 2 , 3 , 4 ) rx mask bits; used in conjunction with the rxwien bit. bit 7 txwien: transmit watermark interrupt enable bit 1 = triggers transmit buffer element watermark interrupt when txmsk<5:0> = txelm<5:0> 0 = disables transmit buffer element watermark interrupt bit 6 unimplemented: read as 0 bit 5-0 txmsk<5:0>: tx buffer mask bits ( 1 , 2 , 3 , 4 ) tx mask bits; used in conjunction with the txwien bit. note 1: mask values higher than fifodepth are not valid. the module will not trigger a match for any value in this case. 2: rxmsk2 and txmsk2 bits are only present when fifodepth = 8 or higher. 3: rxmsk3 and txmsk3 bits are only present when fifodepth = 16 or higher. 4: rxmsk4 and txmsk4 bits are only present when fifodepth = 32. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 240 ? 2015 microchip technology inc. register 17-11: spixurdtl: spix underrun data register low r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 urdata<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 urdata<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 urdata<15:0>: spix underrun data bits these bits are only used when urdten = 1 . this register holds the data to transmit when a transmit underrun condition occurs. when the mode<32,16> or wlength<4:0> bits select 16 to 9-bit data, the spix only uses urdata<15:0>. when the mode<32,16> or wlength<4:0> bits select 8 to 2-b it data, the spix only uses urdata<7:0>. register 17-12: spixurdth: spix underrun data register high r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 urdata<31:24> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 urdata<23:16> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 urdata<31:16>: spix underrun data bits these bits are only used when urdten = 1 . this register holds the data to transmit when a transmit underrun condition occurs. when the mode<32,16> or wlength<4:0> bits select 32 to 25-bit data, the spix only uses urdata<15:0>. when the mode<32,16> or wlength<4:0> bits select 24 to 17-bi t data, the spix only uses urdata<7:0>. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 241 pic24fj1024ga610/gb610 family figure 17-2: spix master/sla ve connection (standard mode) serial transmit buffer (spixtxb) (2) shift register (spixtxsr) lsb msb sdix sdox processor 2 (spix slave) sckx ssx (1) serial receive buffer (spixrxb) (2) serial receive buffer (spixrxb) (2) shift register (spixrxsr) msb lsb sdox sdix processor 1 (spix master) serial clock mssen (spixcon1h<4>) = 1 and msten (spixcon1l<5>) = 0 note 1: using the ssx pin in slave mode of operation is optional. 2: user must write transmit data to read the received data from spixbuf. the spixtxb and spixrxb regis ters are memory-mapped to spixbuf. sckx serial transmit buffer (spixtxb) (2) msten (spixcon1l<5>) = 1 spix buffer (spixbuf) spix buffer (spixbuf) shift register (spixtxsr) shift register (spixrxsr) msb lsb lsb msb sdox sdix downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 242 ? 2015 microchip technology inc. figure 17-3: spix master/slave connection (enhanced buffer modes) serial transmit fifo (spixtxb) (2) shift register (spixtxsr) lsb msb sdix sdox processor 2 (spix slave) sckx ssx (1) serial receive fifo (spixrxb) (2) serial receive fifo (spixrxb) (2) shift register (spixrxsr) msb lsb sdox sdix processor 1 (spix master) serial clock mssen (spixcon1h<4>) = 1 and msten (spixcon1l<5>) = 0 sckx serial transmit fifo (spixtxb) (2) msten (spixcon1l<5>) = 1 spix buffer (spixbuf) spix buffer (spixbuf) shift register (spixtxsr) shift register (spixrxsr) msb lsb lsb msb sdox sdix note 1: using the ssx pin in slave mode of operation is optional. 2: user must write transmit data to read the received data from spixbuf. the spixtxb and spixrxb registe rs are memory-mapped to spixbuf. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 243 pic24fj1024ga610/gb610 family figure 17-4: spix master, fram e master connection diagram pic24fj1024ga610/gb610 serial clock sckx frame sync pulse (1,2) sdix sdox processor 2 ssx sckx (spix master, frame master) serial receive buffer (spixrxb) (3) shift register (spixrxsr) shift register (spixtxsr) serial transmit buffer (spixtxb) (3) (spixbuf) spi buffer serial receive buffer (spixtxb) (3) shift register (spixrxsr) shift register (spixtxsr) serial transmit buffer (spixtxb) (3) (spixbuf) spi buffer (spix slave, frame slave) ssx (1) sdox sdix msb lsb msb lsb msb lsb msb lsb note 1: in framed spi modes, the ssx pin is used to transmit/receive the frame synchronization pulse. 2: framed spi modes require the use of all four pins (i.e., using the ssx pin is not optional). 3: the spixtxb and spixrxb registers are memory-mapped to the spixbuf register. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 244 ? 2015 microchip technology inc. figure 17-5: spix master, f rame slave connection diagram figure 17-6: spix slave, fr ame master connection diagram figure 17-7: spix slave, fr ame slave connection diagram equation 17-1: relationship between device and spix clock speed sdox sdix pic24f serial clock ssx sckx frame sync pulse sdix sdox processor 2 ssx sckx spix master, frame slave) sdox sdix pic24f serial clock ssx sckx frame sync. pulse sdix sdox processor 2 ssx sckx (spix slave, frame master) sdox sdix pic24f serial clock ssx sckx frame sync pulse sdix sdox processor 2 ssx sckx (spix slave, frame slave) baud rate = fpb (2 * (spixbrg + 1)) where: fpb is the peripheral bus clock frequency. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 245 pic24fj1024ga610/gb610 family 18.0 inter-integrated circuit (i 2 c) the inter-integrated circuit (i 2 c) module is a serial interface useful for communicating with other periph- eral or microcontroller devices. these peripheral devices may be serial eeproms, display drivers, a/d converters, etc. the i 2 c module supports these features: independent master and slave logic 7-bit and 10-bit device addresses general call address as defined in the i 2 c protocol clock stretching to provide delays for the processor to respond to a slave data request both 100 khz and 400 khz bus specifications configurable address masking multi-master modes to prevent loss of messages in arbitration bus repeater mode, allowing the acceptance of all messages as a slave, regardless of the address automatic scl a block diagram of the module is shown in figure 18-1 . 18.1 communicating as a master in a single master environment the details of sending a message in master mode depends on the communications protocol for the device being communicated with. typically, the sequence of events is as follows: 1. assert a start condition on sdax and sclx. 2. send the i 2 c device address byte to the slave with a write indication. 3. wait for and verify an acknowledge from the slave. 4. send the first data byte (sometimes known as the command) to the slave. 5. wait for and verify an acknowledge from the slave. 6. send the serial memory address low byte to the slave. 7. repeat steps 4 and 5 until all data bytes are sent. 8. assert a repeated start condition on sdax and sclx. 9. send the device address byte to the slave with a read indication. 10. wait for and verify an acknowledge from the slave. 11. enable master reception to receive serial memory data. 12. generate an ack or nack condition at the end of a received byte of data. 13. generate a stop condition on sdax and sclx. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive refer- ence source. for more information, refer to the dspic33/pic24 family reference manual , inter-integrated circuit? (i 2 c?) (ds70000195), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 246 ? 2015 microchip technology inc. figure 18-1: i2cx block diagram i2cxrcv internal data bus sclx sdax shift match detect start and stop bit detect clock address match clock stretching i2cxtrn lsb shift clock brg down counter reload control t cy /2 start and stop bit generation acknowledge generation collision detect i2cxcon i2cxstat control logic read lsb write read i2cxbrg i2cxrsr write read write read write read write read write read i2cxmsk i2cxadd downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 247 pic24fj1024ga610/gb610 family 18.2 setting baud rate when operating as a bus master to compute the baud rate generator reload value, use equation 18-1 . equation 18-1: computing baud rate reload value ( 1 , 2 , 3 ) 18.3 slave address masking the i2cxmsk register ( register 18-4 ) designates address bit positions as dont care for both 7-bit and 10-bit addressing modes. setting a particular bit location (= 1 ) in the i2cxmsk register causes the slave module to respond, whether the corresponding address bit value is a 0 or a 1 . for example, when i2cxmsk is set to 0010000000 , the slave module will detect both addresses, 0000000000 and 0010000000 . to enable address masking, the intelligent peripheral management interface (ipmi) must be disabled by clearing the strict bit (i2cxconl<11>). table 18-2: i2cx reserved addresses ( 1 ) note 1: based on f cy = f osc /2; doze mode and pll are disabled. 2: these clock rate values are for guidance only. the actual clock rate can be affected by various system- level parameters. the actual clock rate should be measured in its intended application. 3: brg values of 0 and 1 are forbidden. fscl = f cy (i2cxbrg + 2) * 2 [ f cy (f scl * 2) C 2 or: ] i2cxbrg = note: as a result of changes in the i 2 c protocol, the addresses in tab l e 1 8- 2 are reserved and will not be acknowledged in slave mode. this includes any address mask settings that include any of these addresses. table 18-1: i2cx clock rates ( 1 , 2 ) required system f scl f cy i2cxbrg value actual f scl (decimal) (hexadecimal) 100 khz 16 mhz 78 4e 100 khz 100 khz 8 mhz 38 26 100 khz 100 khz 4 mhz 18 12 100 khz 400 khz 16 mhz 18 12 400 khz 400 khz 8 mhz 8 8 400 khz 400 khz 4 mhz 3 3 400 khz 1mhz 16mhz 6 6 1.000mhz 1mhz 8mhz 2 2 1.000mhz note 1: based on f cy = f osc /2; doze mode and pll are disabled. 2: these clock rate values are for guidance only. the actual clock rate can be affected by various system-level parameters. the actual clock rate should be measured in its intended application. slave address r/w bit description 0000 000 0 general call address ( 2 ) 0000 000 1 start byte 0000 001 x cbus address 0000 01x x reserved 0000 1xx x hs mode master code 1111 0xx x 10-bit slave upper byte ( 3 ) 1111 1xx x reserved note 1: the address bits listed here will never cause an address match independent of address mask settings. 2: this address will be acknowledged only if gcen = 1 . 3: a match on this address can only occur on the upper byte in 10-bit addressing mode. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 248 ? 2015 microchip technology inc. register 18-1: i2cxconl: i2 cx control register low r/w-0 u-0 r/w-0, hc r/w-1 r/w-0 r/w-0 r/w-0 r/w-0 i2cen i2csidl sclrel ( 1 ) strict a10m disslw smen bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0, hc r/w-0, hc r/w-0, hc r/w-0, hc r/w-0, hc gcen stren ackdt acken rcen pen rsen sen bit 7 bit 0 legend: hc = hardware clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 i2cen: i2cx enable bit (writable from software only) 1 = enables the i2cx module and configures the sdax and sclx pins as serial port pins 0 = disables the i2cx module; all i 2 c pins are controlled by port functions bit 14 unimplemented: read as 0 bit 13 i2csidl: i2cx stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 sclrel: sclx release control bit (i 2 c slave mode only) ( 1 ) module resets and (i2cen = 0 ) sets sclrel = 1 . if stren = 0 : ( 2 ) 1 = releases clock 0 = forces clock low (clock stretch) if stren = 1 : 1 = releases clock 0 = holds clock low (clock stretch); user may program this bit to 0 , clock stretch at next sclx low bit 11 strict: i2cx strict reserved address rule enable bit 1 = strict reserved addressing is enforced; for reserved addresses, refer to tab le 1 8- 2 . in slave mode: the device doesnt respond to reserved address space and addresses falling in that category are nacked. in master mode: the device is allowed to generate addresses with reserved address space. 0 = reserved addressing would be acknowledged. in slave mode: the device will respond to an address falling in the reserved address space. when there is a match with any of the reserved addresses, the device will generate an ack. in master mode: reserved. bit 10 a10m: 10-bit slave address flag bit 1 = i2cxadd is a 10-bit slave address 0 = i2cxadd is a 7-bit slave address bit 9 disslw: slew rate control disable bit 1 = slew rate control is disabled for standard speed mode (100 khz, also disabled for 1 mhz mode) 0 = slew rate control is enabled for high-speed mode (400 khz) bit 8 smen: smbus input levels enable bit 1 = enables input logic so thresholds are compliant with the smbus specification 0 = disables smbus-specific inputs note 1: automatically cleared to 0 at the beginning of slave transmission; automatically cleared to 0 at the end of slave reception. the user software must provide a delay between writing to the transmit buffer and setting the sclrel bit. this delay must be greater than the minimum set up time for slave transmissi ons, as specified in section 33.0 electrical characteristics . 2: automatically cleared to 0 at the beginning of slave transmission. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 249 pic24fj1024ga610/gb610 family bit 7 gcen: general call enable bit (i 2 c slave mode only) 1 = enables interrupt when a general call address is received in i2cxrsr; module is enabled for reception 0 = general call address is disabled. bit 6 stren: sclx clock stretch enable bit in i 2 c slave mode only; used in conjunction with the sclrel bit. 1 = enables clock stretching 0 = disables clock stretching bit 5 ackdt: acknowledge data bit in i 2 c master mode during master receive mode. the value that will be transmitted when the user initiates an acknowledge sequence at the end of a receive. in i 2 c slave mode when ahen = 1 or dhen = 1 . the value that the slave will transmit when it initiates an acknowledge sequence at the end of an address or data reception. 1 = nack is sent 0 = ack is sent bit 4 acken: acknowledge sequence enable bit in i 2 c master mode only; applicable during master receive mode. 1 = initiates acknowledge sequence on sdax and sclx pins, and transmits ackdt data bit 0 = acknowledge sequence is idle bit 3 rcen: receive enable bit (i 2 c master mode only) 1 = enables receive mode for i 2 c; automatically cleared by hardware at end of 8-bit receive data byte 0 = receive sequence is not in progress bit 2 pen: stop condition enable bit (i 2 c master mode only) 1 = initiates stop condition on sdax and sclx pins 0 = stop condition is idle bit 1 rsen: restart condition enable bit (i 2 c master mode only) 1 = initiates restart condition on sdax and sclx pins 0 = restart condition is idle bit 0 sen: start condition enable bit (i 2 c master mode only) 1 = initiates start condition on sdax and sclx pins 0 = start condition is idle register 18-1: i2cxconl: i2cx co ntrol register low (continued) note 1: automatically cleared to 0 at the beginning of slave transmission; automatically cleared to 0 at the end of slave reception. the user software must provide a delay between writing to the transmit buffer and setting the sclrel bit. this delay must be greater than the minimum set up time for slave transmissi ons, as specified in section 33.0 electrical characteristics . 2: automatically cleared to 0 at the beginning of slave transmission. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 250 ? 2015 microchip technology inc. register 18-2: i2cxconh: i2cx control register high u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pcie scie boen sdaht ( 1 ) sbcde ahen dhen bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-7 unimplemented: read as 0 bit 6 pcie: stop condition interrupt enable bit (i 2 c slave mode only) 1 = enables interrupt on detection of stop condition 0 = stop detection interrupts are disabled bit 5 scie: start condition interrupt enable bit (i 2 c slave mode only) 1 = enables interrupt on detection of start or restart conditions 0 = start detection interrupts are disabled bit 4 boen: buffer overwrite enable bit (i 2 c slave mode only) 1 = i2cxrcv is updated and an ack is generated for a received address/data byte, ignoring the state of the i2cov bit only if rbf bit = 0 0 = i2cxrcv is only updated when i2cov is clear bit 3 sdaht: sdax hold time selection bit ( 1 ) 1 = minimum of 300 ns hold time on sdax after the falling edge of sclx 0 = minimum of 100 ns hold time on sdax after the falling edge of sclx bit 2 sbcde: slave mode bus collision detect enable bit (i 2 c slave mode only) if, on the rising edge of sclx, sdax is sampled low when the module is outputting a high state, the bcl bit is set and the bus goes idle. this detection mode is only valid during data and ack transmit sequences. 1 = enables slave bus collision interrupts 0 = slave bus collision interrupts are disabled bit 1 ahen: address hold enable bit (i 2 c slave mode only) 1 = following the 8th falling edge of sclx for a matching received address byte; sclrel bit (i2cxconl<12>) will be cleared and sclx will be held low 0 = address holding is disabled bit 0 dhen: data hold enable bit (i 2 c slave mode only) 1 = following the 8th falling edge of sclx for a received data byte; slave hardware clears the sclrel bit (i2cxconl<12>) and sclx is held low 0 = data holding is disabled note 1: this bit must be set to 0 for 1 mhz operation. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 251 pic24fj1024ga610/gb610 family register 18-3: i2cxstat: i2cx status register r-0, hsc r-0, hsc r-0, hsc u-0 u-0 r/c-0, hsc r-0, hsc r-0, hsc ackstat trstat acktim bcl gcstat add10 bit 15 bit 8 r/c-0, hs r/c-0, hs r-0, hsc r/c-0, hsc r/c-0, hsc r-0, hsc r-0, hsc r-0, hsc iwcol i2cov d/a psr / w rbf tbf bit 7 bit 0 legend: c = clearable bit hs = hardware settable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown hsc = hardware settable/clearable bit bit 15 ackstat: acknowledge status bit (updated in all master and slave modes) 1 = acknowledge was not received from slave 0 = acknowledge was received from slave bit 14 trstat: transmit status bit (when operating as i 2 c master; applicable to master transmit operation) 1 = master transmit is in progress (8 bits + ack) 0 = master transmit is not in progress bit 13 acktim: acknowledge time status bit (valid in i 2 c slave mode only) 1 = indicates i 2 c bus is in an acknowledge sequence, set on 8th falling edge of sclx clock 0 = not an acknowledge sequence, cleared on 9th rising edge of sclx clock bit 12-11 unimplemented: read as 0 bit 10 bcl: bus collision detect bit (master/slave mode; cleared when i 2 c module is disabled, i2cen = 0 ) 1 = a bus collision has been detected during a master or slave transmit operation 0 = no bus collision has been detected bit 9 gcstat: general call status bit (cleared after stop detection) 1 = general call address was received 0 = general call address was not received bit 8 add10: 10-bit address status bit (cleared after stop detection) 1 = 10-bit address was matched 0 = 10-bit address was not matched bit 7 iwcol: i2cx write collision detect bit 1 = an attempt to write to the i2cxtrn register failed because the i 2 c module is busy; must be cleared in software 0 = no collision bit 6 i2cov: i2cx receive overflow flag bit 1 = a byte was received while the i2cxrcv register is still holding the previous byte; i2cov is a dont care in transmit mode, must be cleared in software 0 = no overflow bit 5 d/a : data/address bit (when operating as i 2 c slave) 1 = indicates that the last byte received was data 0 = indicates that the last byte received or transmitted was an address bit 4 p: i2cx stop bit updated when start, reset or stop is detected; cleared when the i 2 c module is disabled, i2cen = 0 . 1 = indicates that a stop bit has been detected last 0 = stop bit was not detected last downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 252 ? 2015 microchip technology inc. bit 3 s: i2cx start bit updated when start, reset or stop is detected; cleared when the i 2 c module is disabled, i2cen = 0 . 1 = indicates that a start (or repeated start) bit has been detected last 0 = start (or repeated start) bit was not detected last bit 2 r/w : read/write information bit (when operating as i 2 c slave) 1 = read: indicates the data transfer is output from the slave 0 = write: indicates the data transfer is input to the slave bit 1 rbf: receive buffer full status bit 1 = receive is complete, i2cxrcv is full 0 = receive is not complete, i2cxrcv is empty bit 0 tbf: transmit buffer full status bit 1 = transmit is in progress, i2cxtrn is full (8-bits of data) 0 = transmit is complete, i2cxtrn is empty register 18-3: i2cxstat: i2cx status register (continued) register 18-4: i2cxmsk: i2cx slave mode address mask register u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 msk<9:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 msk<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-10 unimplemented: read as 0 bit 9-0 msk<9:0>: i2cx mask for address bit x select bits 1 = enables masking for bit x of the incoming message address; bit match is not required in this position 0 = disables masking for bit x; bit match is required in this position downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 253 pic24fj1024ga610/gb610 family 19.0 universal asynchronous receiver transmitter (uart) the universal asynchronous receiver transmitter (uart) module is one of the serial i/o modules available in the pic24f device family. the uart is a full-duplex, asynchronous system that can communicate with peripheral devices, such as personal computers, lin/j2602, rs-232 and rs-485 interfaces. the module also supports a hardware flow control option with the uxcts and uxrts pins. the uart module includes an irda ? encoder/decoder unit. the pic24fj1024ga610/gb610 family devices are equipped with six uart modules, referred to as uart1, uart2, uart3, uart4, uart5 and uart6. the primary features of the uartx modules are: full-duplex, 8 or 9-bit data transmission through the uxtx and uxrx pins even, odd or no parity options (for 8-bit data) one or two stop bits hardware flow control option with the uxcts and uxrts pins fully integrated baud rate generator with 16-bit prescaler baud rates range from up to 1 mbps and down to 15 hz at 16 mips in 16x mode baud rates range from up to 4 mbps and down to 61 hz at 16 mips in 4x mode 4-deep, first-in-first-out (fifo) transmit data buffer 4-deep fifo receive data buffer parity, framing and buffer overrun error detection support for 9-bit mode with address detect (9 th bit = 1 ) separate transmit and receive interrupts loopback mode for diagnostic support polarity control for transmit and receive lines support for sync and break characters supports automatic baud rate detection irda ? encoder and decoder logic includes dma support 16x baud clock output for irda support a simplified block diagram of the uartx module is shown in figure 19-1 . the uartx module consists of these key important hardware elements: baud rate generator asynchronous transmitter asynchronous receiver note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference manual , uart (ds39708), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. note: throughout this section, references to register and bit names that may be asso- ciated with a specific uart module are referred to generically by the use of x in place of the specific module number. thus, uxsta might refer to the status register for either uart1, uart2, uart3, uart4, uart5 or uart6. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 254 ? 2015 microchip technology inc. figure 19-1: uartx simp lified block diagram irda ? uartx receiver uxtx (1) uxcts (1) uxrts /bclkx (1) note 1: the uart1, uart2, uart3 and uart4 inputs and output s must all be assigned to available rpn/rpin pins before use. see section 11.4 peripheral pin select (pps) for more information. baud rate generator uartx transmitter uxrx (1) hardware flow control downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 255 pic24fj1024ga610/gb610 family 19.1 uartx baud rate generator (brg) the uartx module includes a dedicated, 16-bit baud rate generator. the uxbrg register controls the period of a free-running, 16-bit timer. equation 19-1 shows the formula for computation of the baud rate when brgh = 0 . equation 19-1: uartx baud rate with brgh = 0 ( 1 , 2 ) example 19-1 shows the calculation of the baud rate error for the following conditions: f cy = 4 mhz desired baud rate = 9600 the maximum baud rate (brgh = 0 ) possible is f cy /16 (for uxbrg = 0 ) and the minimum baud rate possible is f cy /(16 * 65536). equation 19-2 shows the formula for computation of the baud rate when brgh = 1 . equation 19-2: uartx baud rate with brgh = 1 ( 1 , 2 ) the maximum baud rate (brgh = 1 ) possible is f cy /4 (for uxbrg = 0 ) and the minimum baud rate possible is f cy /(4 * 65536). writing a new value to the uxbrg register causes the brg timer to be reset (cleared). this ensures the brg does not wait for a timer overflow before generating the new baud rate. example 19-1: baud rate erro r calculation (brgh = 0 ) ( 1 ) note 1: f cy denotes the instruction cycle clock frequency (f osc /2 ). 2: based on f cy = f osc /2; doze mode and pll are disabled. baud rate = f cy 16 (uxbrg + 1) uxbrg = f cy 16 baud rate C 1 note 1: f cy denotes the instruction cycle clock frequency . 2: based on f cy = f osc /2; doze mode and pll are disabled. baud rate = f cy 4 (uxbrg + 1) uxbrg = f cy 4 baud rate C 1 note 1: based on f cy = f osc /2; doze mode and pll are disabled. desired baud rate = f cy /(16 (uxbrg + 1)) solving for uxbrg value: uxbrg = ((f cy /desired baud rate)/16) C 1 uxbrg = ((4000000/9600)/16) C 1 uxbrg = 25 calculated baud rate = 4000000/(16 (25 + 1)) = 9615 error = (calculated baud ra te C desired baud rate) desired baud rate = (9615 C 9600)/9600 = 0.16% downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 256 ? 2015 microchip technology inc. 19.2 transmitting in 8-bit data mode 1. set up the uartx: a) write appropriate values for data, parity and stop bits. b) write appropriate baud rate value to the uxbrg register. c) set up transmit and receive interrupt enable and priority bits. 2. enable the uartx. 3. set the utxen bit (causes a transmit interrupt, two cycles after being set). 4. write a data byte to the lower byte of the uxtxreg word. the value will be immediately transferred to the transmit shift register (tsr) and the serial bit stream will start shifting out with the next rising edge of the baud clock. 5. alternatively, the data byte may be transferred while utxen = 0 and then the user may set utxen. this will cause the serial bit stream to begin immediately because the baud clock will start from a cleared state. 6. a transmit interrupt will be generated as per interrupt control bits, utxisel<1:0>. 19.3 transmitting in 9-bit data mode 1. set up the uartx (as described in section 19.2 transmitting in 8-bit data mode ). 2. enable the uartx. 3. set the utxen bit (causes a transmit interrupt). 4. write uxtxreg as a 16-bit value only. 5. a word write to uxtxreg triggers the transfer of the 9-bit data to the tsr. the serial bit stream will start shifting out with the first rising edge of the baud clock. 6. a transmit interrupt will be generated as per the setting of control bits, utxiselx. 19.4 break and sync transmit sequence the following sequence will send a message frame header, made up of a break, followed by an auto-baud sync byte. 1. configure the uartx for the desired mode. 2. set utxen and utxbrk to set up the break character. 3. load the uxtxreg with a dummy character to initiate transmission (value is ignored). 4. write 55h to uxtxreg; this loads the sync character into the transmit fifo. 5. after the break has been sent, the utxbrk bit is reset by hardware. the sync character now transmits. 19.5 receiving in 8-bit or 9-bit data mode 1. set up the uartx (as described in section 19.2 transmitting in 8-bit data mode ). 2. enable the uartx by setting the urxen bit (uxsta<12>). 3. a receive interrupt will be generated when one or more data characters have been received as per interrupt control bits, urxisel<1:0>. 4. read the oerr bit to determine if an overrun error has occurred. the oerr bit must be reset in software. 5. read uxrxreg. the act of reading the uxrxreg character will move the next character to the top of the receive fifo, including a new set of perr and ferr values. 19.6 operation of uxcts and uxrts control pins uartx clear-to-send (uxcts ) and request-to-send (uxrts ) are the two hardware-controlled pins that are associated with the uartx modules. these two pins allow the uartx to operate in simplex and flow control mode. they are implemented to control the transmission and reception between the data terminal equipment (dte). the uen<1:0> bits in the uxmode register configure these pins. 19.7 infrared support the uartx module provides two types of infrared uart support: one is the irda clock output to support an external irda encoder and decoder device (legacy module support), and the other is the full implementa- tion of the irda encoder and decoder. note that because the irda modes require a 16x baud clock, they will only work when the brgh bit (uxmode<3>) is 0 . 19.7.1 irda clock output for external irda support to support external irda encoder and decoder devices, the bclkx pin (same as the uxrts pin) can be configured to generate the 16x baud clock. when uen<1:0> = 11 , the bclkx pin will output the 16x baud clock if the uartx module is enabled; it can be used to support the irda codec chip. 19.7.2 built-in irda encoder and decoder the uartx has full implementation of the irda encoder and decoder as part of the uartx module. the built-in irda encoder and decoder functionality is enabled using the iren bit (uxmode<12>). when enabled (iren = 1 ), the receive pin (uxrx) acts as the input from the infrared receiver. the transmit pin (uxtx) acts as the output to the infrared transmitter. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 257 pic24fj1024ga610/gb610 family register 19-1: uxmode: uartx mode register r/w-0 u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 uarten ( 1 ) usidl iren ( 2 ) rtsmd uen1 uen0 bit 15 bit 8 r/w-0, hc r/w-0 r/w-0, hc r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 wake lpback abaud urxinv brgh pdsel1 pdsel0 stsel bit 7 bit 0 legend: hc = hardware clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 uarten: uartx enable bit ( 1 ) 1 = uartx is enabled; all uartx pins are controlled by uartx as defined by uen<1:0> 0 = uartx is disabled; all uartx pins are controlled by port latches, uartx power consumption is minimal bit 14 unimplemented: read as 0 bit 13 usidl: uartx stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 iren: irda ? encoder and decoder enable bit ( 2 ) 1 = irda encoder and decoder are enabled 0 = irda encoder and decoder are disabled bit 11 rtsmd: mode selection for uxrts pin bit 1 = uxrts pin is in simplex mode 0 = uxrts pin is in flow control mode bit 10 unimplemented: read as 0 bit 9-8 uen<1:0>: uartx enable bits 11 = uxtx, uxrx and bclkx pins are enabled and used; uxcts pin is controlled by port latches 10 = uxtx, uxrx, uxcts and uxrts pins are enabled and used 01 = uxtx, uxrx and uxrts pins are enabled and used; uxcts pin is controlled by port latches 00 = uxtx and uxrx pins are enabled and used; uxcts and uxrts /bclkx pins are controlled by port latches bit 7 wake: wake-up on start bit detect during sleep mode enable bit 1 = uartx continues to sample the uxrx pin; interrupt is generated on the falling edge, bit is cleared in hardware on the following rising edge 0 = no wake-up is enabled bit 6 lpback: uartx loopback mode select bit 1 = enables loopback mode 0 = loopback mode is disabled bit 5 abaud: auto-baud enable bit 1 = enables baud rate measurement on the next character C requires reception of a sync field (55h); cleared in hardware upon completion 0 = baud rate measurement is disabled or completed bit 4 urxinv: uartx receive polarity inversion bit 1 = uxrx idle state is 0 0 = uxrx idle state is 1 note 1: if uarten = 1 , the peripheral inputs and outputs must be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . 2: this feature is only available for the 16x brg mode (brgh = 0 ). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 258 ? 2015 microchip technology inc. bit 3 brgh: high baud rate enable bit 1 = high-speed mode (4 brg clock cycles per bit) 0 = standard speed mode (16 brg clock cycles per bit) bit 2-1 pdsel<1:0>: parity and data selection bits 11 = 9-bit data, no parity 10 = 8-bit data, odd parity 01 = 8-bit data, even parity 00 = 8-bit data, no parity bit 0 stsel: stop bit selection bit 1 = two stop bits 0 = one stop bit register 19-1: uxmode: uartx mode register (continued) note 1: if uarten = 1 , the peripheral inputs and outputs must be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . 2: this feature is only available for the 16x brg mode (brgh = 0 ). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 259 pic24fj1024ga610/gb610 family register 19-2: uxsta: uartx status and control register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0, hc r/w-0 r-0, hsc r-1, hsc utxisel1 utxinv ( 1 ) utxisel0 urxen utxbrk utxen ( 2 ) utxbf trmt bit 15 bit 8 r/w-0 r/w-0 r/w-0 r-1, hsc r-0, hsc r-0, hsc r/c-0, hs r-0, hsc urxisel1 urxisel0 adden ridle perr ferr oerr urxda bit 7 bit 0 legend: c = clearable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown hs = hardware settable bit hc = hardware clearable bit bit 15,13 utxisel<1:0>: uartx transmission interrupt mode selection bits 11 = reserved; do not use 10 = interrupt when a character is transferred to the transmit shift register (tsr), and as a result, the transmit buffer becomes empty 01 = interrupt when the last character is shifted out of the transmit shift register; all transmit operations are completed 00 = interrupt when a character is transferred to the transmit shift register (this implies there is at leas t one character open in the transmit buffer) bit 14 utxinv: uartx irda ? encoder transmit polarity inversion bit ( 1 ) iren = 0 : 1 = uxtx idle state is 0 0 = uxtx idle state is 1 iren = 1 : 1 = uxtx idle state is 1 0 = uxtx idle state is 0 bit 12 urxen: uartx receive enable bit 1 = receive is enabled, uxrx pin is controlled by uartx 0 = receive is disabled, uxrx pin is controlled by the port bit 11 utxbrk: uartx transmit break bit 1 = sends sync break on next transmission C start bit, followed by twelve 0 bits, followed by stop bit; cleared by hardware upon completion 0 = sync break transmission is disabled or completed bit 10 utxen: uartx transmit enable bit ( 2 ) 1 = transmit is enabled, uxtx pin is controlled by uartx 0 = transmit is disabled, any pending transmission is aborted and the buffer is reset; uxtx pin is controlled by the port bit 9 utxbf: uartx transmit buffer full status bit (read-only) 1 = transmit buffer is full 0 = transmit buffer is not full, at least one more character can be written bit 8 trmt: transmit shift register empty bit (read-only) 1 = transmit shift register is empty and transmit buffer is empty (the last transmission has completed) 0 = transmit shift register is not empty, a transmission is in progress or queued note 1: the value of this bit only affects the transmit properties of the module when the irda ? encoder is enabled (iren = 1 ). 2: if uarten = 1 , the peripheral inputs and outputs must be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 260 ? 2015 microchip technology inc. bit 7-6 urxisel<1:0>: uartx receive interrupt mode selection bits 11 = interrupt is set on an rsr transfer, making the receive buffer full (i.e., has 4 data characters) 10 = interrupt is set on an rsr transfer, making the receive buffer 3/4 full (i.e., has 3 data characters) 0x = interrupt is set when any character is received and transferred from the rsr to the receive buffer; receive buffer has one or more characters bit 5 adden: address character detect bit (bit 8 of received data = 1 ) 1 = address detect mode is enabled (if 9-bit mode is not selected, this does not take effect) 0 = address detect mode is disabled bit 4 ridle: receiver idle bit (read-only) 1 = receiver is idle 0 = receiver is active bit 3 perr: parity error status bit (read-only) 1 = parity error has been detected for the current character (the character at the top of the receive fifo) 0 = parity error has not been detected bit 2 ferr: framing error status bit (read-only) 1 = framing error has been detected for the current charac ter (the character at the top of the receive fifo) 0 = framing error has not been detected bit 1 oerr: receive buffer overrun error status bit (clear/read-only) 1 = receive buffer has overflowed 0 = receive buffer has not overflowed (clearing a previously set oerr bit, 1 ? 0 transition); will reset the receive buffer and the rsr to the empty state bit 0 urxda: uartx receive buffer data available bit (read-only) 1 = receive buffer has data, at least one more character can be read 0 = receive buffer is empty register 19-2: uxsta: uartx status and control register (continued) note 1: the value of this bit only affects the transmit properties of the module when the irda ? encoder is enabled (iren = 1 ). 2: if uarten = 1 , the peripheral inputs and outputs must be configured to an available rpn/rpin pin. for more information, see section 11.4 peripheral pin select (pps) . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 261 pic24fj1024ga610/gb610 family register 19-3: uxrxreg: uartx receive register (normally read-only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 r-0 uxrxreg8 bit 15 bit 8 r-0 r-0 r-0 r-0 r-0 r-0 r-0 r-0 uxrxreg<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-9 unimplemented: read as 0 bit 8-0 uxrxreg<8:0>: data of the received character bits register 19-4: uxtxreg: uartx transmit register (normally write-only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 w-x uxtxreg8 bit 15 bit 8 w-x w-x w-x w-x w-x w-x w-x w-x uxtxreg<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-9 unimplemented: read as 0 bit 8-0 uxtxreg<8:0>: data of the transmitted character bits downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 262 ? 2015 microchip technology inc. register 19-5: uxbrg: uartx baud rate generator register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 brg<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 brg<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 brg<15:0>: baud rate divisor bits register 19-6: uxadmd: uartx address detect and match register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 admmask7 admmask6 admmask5 admmask4 admmask3 admmask2 admmask1 admmask0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 admaddr7 admaddr6 admaddr5 admaddr4 admaddr3 admaddr2 admaddr1 admaddr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 admmask<7:0>: admaddr<7:0> (uxadmd<7:0>) masking bits for adm ma sk x: 1 = admaddrx is used to detect the address match 0 = admaddrx is not used to detect the address match bit 7-0 admaddr<7:0>: address detect task off-load bits used with the admmask<7:0> bits (uxadmd<15:8> to off-load the task of detecting the address character from the processor during address detect mode. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 263 pic24fj1024ga610/gb610 family 20.0 universal serial bus with on-the-go support (usb otg) pic24fj1024gb610 family devices contain a full- speed and low-speed compatible, on-the-go (otg) usb serial interface engine (sie). the otg capability allows the device to act as either a usb peripheral device or as a usb embedded host with limited host capabilities. the otg capability allows the device to dynamically switch from device to host operation using otgs host negotiation protocol (hnp). for more details on otg operation, refer to the on- the-go supplement to the usb 2.0 specification , published by the usb-if. for more details on usb operation, refer to the universal serial bus specification , v2.0. the usb otg module offers these features: usb functionality in device and host modes, and otg capabilities for application-controlled mode switching software-selectable module speeds of full speed (12 mbps) or low speed (1.5 mbps available in host mode only) support for all four usb transfer types: control, interrupt, bulk and isochronous 16 bidirectional endpoints for a total of 32 unique endpoints dma interface for data ram access queues up to 16 unique endpoint transfers without servicing integrated, on-chip usb transceiver with support for off-chip transceivers via a digital interface integrated v bus generation with on-chip comparators and boost generation, and support of external v bus comparators and regulators through a digital interface configurations for on-chip bus pull-up and pull-down resistors a simplified block diagram of the usb otg module is shown in figure 20-1 . the usb otg module can function as a usb peripheral device or as a usb host, and may dynamically switch between device and host modes under software control. in either mode, the same data paths and buffer descriptors (bds) are used for the transmission and reception of data. in discussing usb operation, this section will use a controller-centric nomenclature for describing the direc- tion of the data transfer between the microcontroller and the usb. rx (receive) will be used to describe transfers that move data from the usb to the microcontroller and tx (transmit) will be used to describe transfers that move data from the microcontroller to the usb. table 20-1 shows the relationship between data direction in this nomenclature and the usb tokens exchanged. table 20-1: controller-centric data direction for usb host or target this chapter presents the most basic operations needed to implement usb otg functionality in an application. a complete and detailed discussion of the usb protocol and its otg supplement are beyond the scope of this data sheet. it is assumed that the user already has a basic understanding of usb architecture and the latest version of the protocol. not all steps for proper usb operation (such as device enumeration) are presented here. it is recommended that application developers use an appropriate device driver to implement all of the necessary features. microchip provides a number of application-specific resources, such as usb firmware and driver support. refer to www.microchip.com/usb for the latest firmware and driver support. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference manual , usb on-the-go (otg) (ds39721), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. usb mode direction rx tx device out or setup in host in out or setup downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 264 ? 2015 microchip technology inc. figure 20-1: usb otg module block diagram 48 mhz usb clock d+ (1) d- (1) usbid (1) v bus (1) transceiver comparators usb srp charge srp discharge registers and control interface voltage system ram full-speed pull-up host pull-down host pull-down note 1: pins are multiplexed with digi tal i/o and other device features. 2: connecting v bus3v3 to v dd is highly recommended, as floating this input can cause increased i pd currents. the pin should be tied to v dd when the usb functions are not used. rcv (1) v bus boost assist external transceiver interface usboen (1) transceiver power 3.3v v usb3v3 (2) sie usb downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 265 pic24fj1024ga610/gb610 family 20.1 hardware configuration 20.1.1 device mode 20.1.1.1 d+ pull-up resistor pic24fj1024gb610 family devices have a built-in 1.5 k ? resistor on the d+ line that is available when the microcontroller is operating in device mode. this is used to signal an external host that the device is operating in full-speed device mode. it is engaged by setting the usben bit (u1con<0>) and powering up the usb module (usbpwr = 1 ). if the otgen bit (u1otgcon<2>) is set, then the d+ pull-up is enabled through the dppulup bit (u1otgcon<7>). 20.1.1.2 the v bus pin in order to meet the usb 2.0 specification require- ment, relating to the back drive voltage on the d+/d- pins, the usb module incorporates v bus -level sensing comparators. when the comparators detect the v bus level below the v a _ sess _v ld level, the hardware will automatically disable the d+ pull-up resistor described in section 20.1.1.1 d+ pull-up resistor . this allows the device to automatically meet the back drive requirement for d+ and d-, even if the application firm- ware does not explicitly monitor the v bus level. there- fore, the v bus microcontroller pin should not be left floating in usb device mode application designs, and should normally be connected to the v bus pin on the usb connector/cable (either directly or through a small resistance ? 100 ohms). 20.1.1.3 power modes many usb applications will likely have several different sets of power requirements and configuration. the most common power modes encountered are: bus power only mode self-power only mode dual power with self-power dominance bus power only mode ( figure 20-2 ) is effectively the simplest method. all power for the application is drawn from the usb. to meet the inrush current requirements of the usb 2.0 specification , the total effective capacitance, appearing across v bus and ground, must be no more than 10 ? f. in the usb suspend mode, devices must consume no more than 2.5 ma from the 5v v bus line of the usb cable. during the usb suspend mode, the d+ or d- pull-up resistor must remain active, which will consume some of the allowed suspend current. in self-power only mode ( figure 20-3 ), the usb application provides its own power, with very little power being pulled from the usb. note that an attach indication is added to indicate when the usb has been connected and the host is actively powering v bus . to meet compliance specifications, the usb module (and the d+ or d- pull-up resistor) should not be enabled until the host actively drives v bus high. one of the 5.5v tolerant i/o pins may be used for this purpose. the application should never source any current onto the 5v v bus pin of the usb cable when the usb module is operated in usb device mode. the dual power mode with self-power dominance ( figure 20-4 ) allows the application to use internal power primarily, but switch to power from the usb when no internal power is available. dual power devices must also meet all of the special requirements for inrush current and suspend mode current previ- ously described, and must not enable the usb module until v bus is driven high. figure 20-2: bus-powered interface example figure 20-3: self-power only figure 20-4: dual power example v dd v usb3v3 v ss v bus ~5v 3.3v mcp1801 attach sense v bus 100 ? 3.3v ldo 1 ? f v dd v usb3v3 v ss v self ~3.3v attach sense 100 k ? 100 ? v bus ~5v v bus v dd v usb3v3 v bus v ss attach sense v bus v self 100 ? ~3.3v ~5v 100 k ? 3.3v low i q regulator downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 266 ? 2015 microchip technology inc. 20.1.2 host and otg modes 20.1.2.1 d+ and d- pull-down resistors pic24fj1024gb610 family devices have a built-in 15 k ? pull-down resistor on the d+ and d- lines. these are used in tandem to signal to the bus that the micro- controller is operating in host mode. they are engaged by setting the hosten bit (u1con<3>). if the otgen bit (u1otgcon<2>) is set, then these pull-downs are enabled by setting the dppuldwn and dmpuldwn bits (u1otgcon<5:4>). 20.1.2.2 power configurations in host mode, as well as host mode in on-the-go operation, the usb 2.0 specification requires that the host application should supply power on v bus . since the microcontroller is running below v bus , and is not able to source sufficient current, a separate power supply must be provided. when the application is always operating in host mode, a simple circuit can be used to supply v bus and regulate current on the bus ( figure 20-5 ). for otg operation, it is necessary to be able to turn v bus on or off as needed, as the microcontroller switches between device and host modes. a typical example using an external charge pump is shown in figure 20-6 . figure 20-5: host interface example figure 20-6: otg interface example a/d pin v usb3v3 v dd v ss d+d- v bus id d+ d- v bus id gnd +3.3v +3.3v polymer ptc thermal fuse micro a/b connector 150 f 2 k ? 2 k ? 0.1 f 3.3v +5v pic ? mcu i/o i/o v ss d+d- v bus id micro a/b connector 40 k ? 4.7 f v dd pic ? mcu 10 f v in select shnd pgood mcp1253 v out c+c- gnd 1 f d+ d- v bus id gnd v usb3v3 v dd +3.3v +3.3v 0.1 f 3.3v downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 267 pic24fj1024ga610/gb610 family 20.1.3 calculating transceiver power requirements the usb transceiver consumes a variable amount of current depending on the characteristic impedance of the usb cable, the length of the cable, the v usb supply voltage and the actual data patterns moving across the usb cable. longer cables have larger capacitances and consume more total energy when switching output states. the total transceiver current consumption will be application-specific. equation 20-1 can help estimate how much current actually may be required in full-speed applications. refer to the dspic33/pic24 family reference manual , usb on-the-go (otg) (ds39721) for a complete discussion on transceiver power consumption. equation 20-1: estimating usb transceiver current consumption legend: v usb C voltage applied to the v usb3v3 pin in volts (3.0v to 3.6v). p zero C percentage (in decimal) of the in traffic bits sent by the pic ? microcontroller that are a value of 0 . p in C percentage (in decimal) of total bus bandwidth that is used for in traffic. l cable C length (in meters) of the usb cable. the usb 2.0 specification requires that full-speed applications use cables no longer than 5m. i pullup C current which the nominal, 1.5 k ? pull-up resistor (when enabled) must supply to the usb cable. 40 ma v usb p zero p in l cable ixcvr = 3.3v 5m + i pullup downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 268 ? 2015 microchip technology inc. 20.2 usb buffer descriptors and the bdt endpoint buffer control is handled through a structure called the buffer descriptor table (bdt). this provides a flexible method for users to construct and control endpoint buffers of various lengths and configurations. the bdt can be located in any available 512-byte, aligned block of data ram. the bdt pointer (u1bdtp1) contains the upper address byte of the bdt and sets the location of the bdt in ram. the user must set this pointer to indicate the tables location. the bdt is composed of buffer descriptors (bds) which are used to define and control the actual buffers in the usb ram space. each bd consists of two 16-bit, soft (non-fixed-address) registers, bdnstat and bdnadr, where n represents one of the 64 possible bds (range of 0 to 63). bdnstat is the status register for bdn, while bdnadr specifies the starting address for the buffer associated with bdn. depending on the endpoint buffering configuration used, there are up to 64 sets of buffer descriptors, for a total of 256 bytes. at a minimum, the bdt must be at least 8 bytes long. this is because the usb 2.0 specification mandates that every device must have endpoint 0 with both input and output for initial setup. endpoint mapping in the bdt is dependent on three variables: endpoint number (0 to 15) endpoint direction (rx or tx) ping-pong settings (u1cnfg1<1:0>) figure 20-7 illustrates how these variables are used to map endpoints in the bdt. in host mode, only endpoint 0 buffer descriptors are used. all transfers utilize the endpoint 0 buffer descrip- tor and endpoint control register (u1ep0). for received packets, the attached devices source endpoint is indicated by the value of endpt<3:0> in the usb status register (u1stat<7:4>). for transmitted packets, the attached devices destination endpoint is indicated by the value written to the usb token register (u1tok). figure 20-7: bdt mapping for endpoint buffering modes note: since bdnadr is a 16-bit register, only the first 64 kbytes of ram can be accessed by the usb module. ep1 tx even ep1 rx even ep1 rx odd ep1 tx odd descriptor descriptor descriptor descriptor ep1 tx ep15 tx ep1 rx ep0 rx ppb<1:0> = 00 ep0 tx ep1 tx no ping-pong ep15 tx ep0 tx ep0 rx even ppb<1:0> = 01 ep0 rx odd ep1 rx ping-pong buffer ep15 tx odd ep0 tx even ep0 rx even ppb<1:0> = 10 ep0 rx odd ep0 tx odd ping-pong buffers descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor descriptor note: memory area is not shown to scale. descriptor descriptor descriptor descriptor buffers on ep0 rx on all eps ep1 tx even ep1 rx even ep1 rx odd ep1 tx odd descriptor descriptor descriptor descriptor ep15 tx odd ep0 rx ppb<1:0> = 11 ep0 tx ping-pong buffers descriptor descriptor descriptor on all other eps except ep0 total bdt space: total bdt space: total bdt space: total bdt space: 128 bytes 132 bytes 256 bytes 248 bytes downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 269 pic24fj1024ga610/gb610 family bds have a fixed relationship to a particular endpoint, depending on the buffering configuration. tab l e 2 0- 2 provides the mapping of bds to endpoints. this rela- tionship also means that gaps may occur in the bdt if endpoints are not enabled contiguously. this, theoreti- cally, means that the bds for disabled endpoints could be used as buffer space. in practice, users should avoid using such spaces in the bdt unless a method of validating bd addresses is implemented. 20.2.1 buffer ownership because the buffers and their bds are shared between the cpu and the usb module, a simple semaphore mechanism is used to distinguish which is allowed to update the bd and associated buffers in memory. this is done by using the uown bit as a semaphore to distinguish which is allowed to update the bd and associated buffers in memory. uown is the only bit that is shared between the two configurations of bdnstat. when uown is clear, the bd entry is owned by the microcontroller core. when the uown bit is set, the bd entry and the buffer memory are owned by the usb peripheral. the core should not modify the bd or its corresponding data buffer during this time. note that the microcontroller core can still read bdnstat while the sie owns the buffer and vice versa. the buffer descriptors have a different meaning based on the source of the register update. register 20-1 and register 20-2 show the differences in bdnstat depending on its current ownership. when uown is set, the user can no longer depend on the values that were written to the bds. from this point, the usb module updates the bds as necessary, over- writing the original bd values. the bdnstat register is updated by the sie with the token pid and the transfer count is updated. 20.2.2 dma interface the usb otg module uses a dedicated dma to access both the bdt and the endpoint data buffers. since part of the address space of the dma is dedi- cated to the buffer descriptors, a portion of the memory connected to the dma must comprise a contiguous address space, properly mapped for the access by the module. table 20-2: assignment of buffer descript ors for the different buffering modes endpoint bds assigned to endpoint mode 0 (no ping-pong) mode 1 (ping-pong on ep0 rx) mode 2 (ping-pong on all eps) mode 3 (ping-pong on all other eps, except ep0) rx tx rx tx rx tx rx tx 0 0 1 0 (e), 1 (o) 2 0 (e), 1 (o) 2 (e), 3 (o) 0 1 1 2 3 3 4 4 (e), 5 (o) 6 (e), 7 (o) 2 (e), 3 (o) 4 (e), 5 (o) 2 4 5 5 6 8 (e), 9 (o) 10 (e), 11 (o) 6 (e), 7 (o) 8 (e), 9 (o) 3 6 7 7 8 12 (e), 13 (o) 14 (e), 15 (o) 10 (e), 11 (o) 12 (e), 13 (o) 4 8 9 9 10 16 (e), 17 (o) 18 (e), 19 (o) 14 (e), 15 (o) 16 (e), 17 (o) 5 10 11 11 12 20 (e), 21 (o) 22 (e), 23 (o) 18 (e), 19 (o) 20 (e), 21 (o) 6 12 13 13 14 24 (e), 25 (o) 26 (e), 27 (o) 22 (e), 23 (o) 24 (e), 25 (o) 7 14 15 15 16 28 (e), 29 (o) 30 (e), 31 (o) 26 (e), 27 (o) 28 (e), 29 (o) 8 16 17 17 18 32 (e), 33 (o) 34 (e), 35 (o) 30 (e), 31 (o) 32 (e), 33 (o) 9 18 19 19 20 36 (e), 37 (o) 38 (e), 39 (o) 34 (e), 35 (o) 36 (e), 37 (o) 10 20 21 21 22 40 (e), 41 (o) 42 (e), 43 (o) 38 (e), 39 (o) 40 (e), 41 (o) 11 22 23 23 24 44 (e), 45 (o) 46 (e), 47 (o) 42 (e), 43 (o) 44 (e), 45 (o) 12 24 25 25 26 48 (e), 49 (o) 50 (e), 51 (o) 46 (e), 47 (o) 48 (e), 49 (o) 13 26 27 27 28 52 (e), 53 (o) 54 (e), 55 (o) 50 (e), 51 (o) 52 (e), 53 (o) 14 28 29 29 30 56 (e), 57 (o) 58 (e), 59 (o) 54 (e), 55 (o) 56 (e), 57 (o) 15 30 31 31 32 60 (e), 61 (o) 62 (e), 63 (o) 58 (e), 59 (o) 60 (e), 61 (o) legend: (e) = even transaction buffer, (o) = odd transaction buffer downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 270 ? 2015 microchip technology inc. register 20-1: bdnstat: buffer descript or n status register prototype, usb mode (bd0stat through bd63stat) r/w-x r/w-x r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc uown dts pid3 pid2 pid1 pid0 bc9 bc8 bit 15 bit 8 r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hs c bc7 bc6 bc5 bc4 bc3 bc2 bc1 bc0 bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 uown: usb own bit 1 = the usb module owns the bd and its corresponding buffer; the cpu must not modify the bd or the buffer bit 14 dts: data toggle packet bit 1 = data 1 packet 0 = data 0 packet bit 13-10 pid<3:0>: packet identifier bits (written by the usb module) in device mode: represents the pid of the received token during the last transfer. in host mode: represents the last returned pid or the transfer status indicator. bit 9-0 bc<9:0>: byte count bits this represents the number of bytes to be transmitted or the maximum number of bytes to be received during a transfer. upon completion, the byte count is updated by the usb module with the actual number of bytes transmitted or received. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 271 pic24fj1024ga610/gb610 family register 20-2: bdnstat: buffer descript or n status register prototype, cpu mode (bd0stat through bd63stat) r/w-x r/w-x r-0 r-0 r/w-x r/w-x r/w-x, hsc r/w-x, hsc uown dts ( 1 ) dtsen bstall bc9 bc8 bit 15 bit 8 r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc r/w-x, hsc bc7 bc6 bc5 bc4 bc3 bc2 bc1 bc0 bit 7 bit 0 legend: r = reserved bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set r = reserved bit x = bit is unknown bit 15 uown: usb own bit 0 = the microcontroller core owns the bd and its corresponding buffer; the usb module ignores all other fields in the bd bit 14 dts: data toggle packet bit ( 1 ) 1 = data 1 packet 0 = data 0 packet bit 13-12 reserved: maintain as 0 bit 11 dtsen: data toggle synchronization enable bit 1 = data toggle synchronization is enabled; data packets with incorrect sync value will be ignored 0 = no data toggle synchronization is performed bit 10 bstall: buffer stall enable bit 1 = buffer stall is enabled; stall handshake issued if a token is received that would use the bd in the given location (uown bit remains set, bd value is unchanged); corresponding epstall bit will get set on any stall handshake 0 = buffer stall is disabled bit 9-0 bc<9:0>: byte count bits this represents the number of bytes to be transmitted or the maximum number of bytes to be received during a transfer. upon completion, the byte count is updated by the usb module with the actual number of bytes transmitted or received. note 1: this bit is ignored unless dtsen = 1 . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 272 ? 2015 microchip technology inc. 20.3 usb interrupts the usb otg module has many conditions that can be configured to cause an interrupt. all interrupt sources use the same interrupt vector. figure 20-8 shows the interrupt logic for the usb module. there are two layers of interrupt registers in the usb module. the top level consists of overall usb status interrupts; these are enabled and flagged in the u1ie and u1ir registers, respectively. the second level consists of usb error conditions, which are enabled and flagged in the u1eir and u1eie registers. an interrupt condition in any of these triggers a usb error interrupt flag (uerrif) in the top level. unlike the device-level interrupt flags in the ifsx registers, usb interrupt flags in the u1ir registers can only be cleared by writing a 1 to the bit position. interrupts may be used to trap routine events in a usb transaction. figure 20-9 provides some common events within a usb frame and their corresponding interrupts. figure 20-8: usb otg interrupt funnel dmaef dmaee btoef btoee dfn8ef dfn8ee crc16ef crc16ee crc5ef (eofef) crc5ee (eofee) pidef pidee attachif attachie resumeif resumeie idleif idleie trnif trnie sofif sofie urstif (detachif) urstie (detachie) (uerrif) uerrie set usb1if stallif stallie btsef btsee t1msecif timsecie lstateif lstateie actvif actvie sesvdif sesvdie sesendif sesendie vbusvdif vbusvdie idif idie second level (usb error) interrupts top level (usb status) interrupts top level (usb otg) interrupts downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 273 pic24fj1024ga610/gb610 family 20.3.1 clearing usb otg interrupts unlike device-level interrupts, the usb otg interrupt status flags are not freely writable in software. all usb otg flag bits are implemented as hardware set only bits. additionally, these bits can only be cleared in software by writing a 1 to their locations (i.e., perform- ing a mov type instruction). writing a 0 to a flag bit (i.e., a bclr instruction) has no effect. figure 20-9: example of a usb transaction and interrupt events 20.4 device mode operation the following section describes how to perform a com- mon device mode task. in device mode, usb transfers are performed at the transfer level. the usb module automatically performs the status phase of the transfer. 20.4.1 enabling device mode 1. reset the ping-pong buffer pointers by setting, then clearing, the ping-pong buffer reset bit, ppbrst (u1con<1>). 2. disable all interrupts (u1ie and u1eie = 00h). 3. clear any existing interrupt flags by writing ffh to u1ir and u1eir. 4. verify that v bus is present (non-otg devices only). 5. enable the usb module by setting the usben bit (u1con<0>). 6. set the otgen bit (u1otgcon<2>) to enable otg operation. 7. enable the endpoint 0 buffer to receive the first setup packet by setting the eprxen and ephshk bits for endpoint 0 (u1ep0<3,0> = 1 ). 8. power up the usb module by setting the usbpwr bit (u1pwrc<0>). 9. enable the d+ pull-up resistor to signal an attach by setting the dppulup bit (u1otgcon<7>). note: throughout this data sheet, a bit that can only be cleared by writing a 1 to its loca- tion is referred to as write 1 to clear. in register descriptions; this function is indicated by the descriptor, k. usb reset sof reset setup data status sof setup token data ack out token empty data ack start-of-frame (sof) in token data ack sofif urstif 1ms frame differential data from host from host to host from host to host from host from host from host to host transaction control transfer (1) transaction complete note 1: the control transfer shown here is only an example showi ng events that can occur for every transaction. typical control transfers will spread across multiple frames. set trnif set trnif set trnif downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 274 ? 2015 microchip technology inc. 20.4.2 receiving an in token in device mode 1. attach to a usb host and enumerate as described in chapter 9 of the usb 2.0 specification . 2. create a data buffer and populate it with the data to send to the host. 3. in the appropriate (even or odd) tx bd for the desired endpoint: a) set up the status register (bdnstat) with the correct data toggle (data0/1) value and the byte count of the data buffer. b) set up the address register (bdnadr) with the starting address of the data buffer. c) set the uown bit of the status register to 1 . 4. when the usb module receives an in token, it automatically transmits the data in the buffer. upon completion, the module updates the status register (bdnstat) and sets the token complete interrupt flag, trnif (u1ir<3>). 20.4.3 receiving an out token in device mode 1. attach to a usb host and enumerate as described in chapter 9 of the usb 2.0 specification . 2. create a data buffer with the amount of data you are expecting from the host. 3. in the appropriate (even or odd) tx bd for the desired endpoint: a) set up the status register (bdnstat) with the correct data toggle (data0/1) value and the byte count of the data buffer. b) set up the address register (bdnadr) with the starting address of the data buffer. c) set the uown bit of the status register to 1 . 4. when the usb module receives an out token, it automatically receives the data sent by the host to the buffer. upon completion, the module updates the status register (bdnstat) and sets the token complete interrupt flag, trnif (u1ir<3>). 20.5 host mode operation the following sections describe how to perform common host mode tasks. in host mode, usb transfers are invoked explicitly by the host software. the host software is responsible for the acknowledge portion of the transfer. also, all transfers are performed using the endpoint 0 control register (u1ep0) and buffer descriptors. 20.5.1 enable host mode and discover a connected device 1. enable host mode by setting the hosten bit (u1con<3>). this causes the host mode con- trol bits in other usb otg registers to become available. 2. enable the d+ and d- pull-down resistors by setting the dppuldwn and dmpuldwn bits (u1otgcon<5:4>). disable the d+ and d- pull-up resistors by clearing the dppulup and dmpulup bits (u1otgcon<7:6>). 3. at this point, sof generation begins with the sof counter loaded with 12,000. eliminate noise on the usb by clearing the sofen bit (u1con<0>) to disable start-of-frame (sof) packet generation. 4. enable the device attached interrupt by setting the attachie bit (u1ie<6>). 5. wait for the device attached interrupt (u1ir<6> = 1 ). this is signaled by the usb device changing the state of d+ or d- from 0 to 1 (se0 to j-state). after it occurs, wait 100 ms for the device power to stabilize. 6. check the state of the jstate and se0 bits in u1con. if the jstate bit (u1con<7>) is 0 , the connecting device is low speed. if the con- necting device is low speed, set the lspden and lspd bits (u1addr<7> and u1ep0<7>) to enable low-speed operation. 7. reset the usb device by setting the usbrst bit (u1con<4>) for at least 50 ms, sending reset signaling on the bus. after 50 ms, terminate the reset by clearing usbrst. 8. in order to keep the connected device from going into suspend, enable the sof packet generation by setting the sofen bit. 9. wait 10 ms for the device to recover from reset. 10. perform enumeration as described by chapter 9 of the usb 2.0 specification . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 275 pic24fj1024ga610/gb610 family 20.5.2 complete a control transaction to a connected device 1. follow the procedure described in section 20.5.1 enable host mode and discover a connected device to discover a device. 2. set up the endpoint control register for bidirectional control transfers by writing 0dh to u1ep0 (this sets the epcondis, eptxen and ephshk bits). 3. place a copy of the device framework setup command in a memory buffer. see chapter 9 of the usb 2.0 specification for information on the device framework command set. 4. initialize the buffer descriptor (bd) for the current (even or odd) tx ep0 to transfer the eight bytes of command data for a device framework command (i.e., get device descriptor ): a) set the bd data buffer address (bd0adr) to the starting address of the 8-byte memory buffer containing the command. b) write 8008h to bd0stat (this sets the uown bit and sets a byte count of 8). 5. set the usb device address of the target device in the address register (u1addr<6:0>). after a usb bus reset, the device usb address will be zero. after enumeration, it will be set to another value between 1 and 127. 6. write d0h to u1tok; this is a setup token to endpoint 0, the target devices default control pipe. this initiates a setup token on the bus, followed by a data packet. the device hand- shake is returned in the pid field of bd0stat after the packets are complete. when the usb module updates bd0stat, a token complete interrupt flag is asserted (the trnif flag is set). this completes the setup phase of the setup transaction, as referenced in chapter 9 of the usb 2.0 specification . 7. to initiate the data phase of the setup transac- tion (i.e., get the data for the get device descriptor command), set up a buffer in memory to store the received data. 8. initialize the current (even or odd) rx or tx (rx for in, tx for out) ep0 bd to transfer the data. a) write c040h to bd0stat. this sets the uown, configures the data toggle bit (dts) to data1 and sets the byte count to the length of the data buffer (64 or 40h in this case). b) set bd0adr to the starting address of the data buffer. 9. write the token register with the appropriate in or out token to endpoint 0, the target devices default control pipe (e.g., write 90h to u1tok for an in token for a get device descriptor command). this initiates an in token on the bus, followed by a data packet from the device to the host. when the data packet completes, the bd0stat is written and a token complete inter- rupt flag is asserted (the trnif flag is set). for control transfers with a single packet data phase, this completes the data phase of the setup transaction, as referenced in chapter 9 of the usb 2.0 specification . if more data needs to be transferred, return to step 8. 10. to initiate the status phase of the setup transac- tion, set up a buffer in memory to receive or send the zero length status phase data packet. 11. initialize the current (even or odd) tx ep0 bd to transfer the status data: a) set the bdt buffer address field to the start address of the data buffer. b) write 8000h to bd0stat (set uown bit, configure dts to data0 and set byte count to 0). 12. write the token register with the appropriate in or out token to endpoint 0, the target devices default control pipe (e.g., write 01h to u1tok for an out token for a get device descriptor command). this initiates an out token on the bus, followed by a zero length data packet from the host to the device. when the data packet completes, the bd is updated with the hand- shake from the device and a token complete interrupt flag is asserted (the trnif flag is set). this completes the status phase of the setup transaction, as described in chapter 9 of the usb 2.0 specification . note: only one control transaction can be performed per frame. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 276 ? 2015 microchip technology inc. 20.5.3 send a full-speed bulk data transfer to a target device 1. follow the procedure described in section 20.5.1 enable host mode and discover a connected device and section 20.5.2 complete a con- trol transaction to a connected device to discover and configure a device. 2. to enable transmit and receive transfers with handshaking enabled, write 1dh to u1ep0. if the target device is a low-speed device, also set the lspd (u1ep0<7>) bit. if you want the hard- ware to automatically retry indefinitely if the tar- get device asserts a nak on the transfer, clear the retry disable bit, retrydis (u1ep0<6>). 3. set up the bd for the current (even or odd) tx ep0 to transfer up to 64 bytes. 4. set the usb device address of the target device in the address register (u1addr<6:0>). 5. write an out token to the desired endpoint to u1tok. this triggers the modules transmit state machines to begin transmitting the token and the data. 6. wait for the token complete interrupt flag, trnif. this indicates that the bd has been released back to the microprocessor and the transfer has completed. if the retry disable bit (retrydis) is set, the handshake (ack, nak, stall or error (0fh)) is returned in the bd pid field. if a stall interrupt occurs, the pending packet must be dequeued and the error condition in the target device cleared. if a detach interrupt occurs (se0 for more than 2.5 s), then the target has detached (u1ir<0> is set). 7. once the token complete interrupt flag occurs (trnif is set), the bd can be examined and the next data packet queued by returning to step 2. 20.6 otg operation 20.6.1 session request protocol (srp) an otg a-device may decide to power down the v bus supply when it is not using the usb link through the session request protocol (srp). srp can only be initi- ated at full speed. software may do this by configuring a gpio pin to disable an external power transistor, or volt- age regulator enable signal, which controls the v bus supply. when the v bus supply is powered down, the a-device is said to have ended a usb session. an otg a-device or embedded host may repower the v bus supply at any time (initiate a new session). an otg b-device may also request that the otg a-device repower the v bus supply (initiate a new session). this is accomplished via session request protocol (srp). prior to requesting a new session, the b-device must first check that the previous session has definitely ended. to do this, the b-device must check for two conditions: 1. v bus supply is below the session valid voltage. 2. both d+ and d- have been low for at least 2 ms. the b-device will be notified of condition 1 by the sesendif (u1otgir<2>) interrupt. software will have to manually check for condition 2. the b-device may aid in achieving condition 1 by dis- charging the v bus supply through a resistor. software may do this by setting vbusdis (u1otgcon<0>). after these initial conditions are met, the b-device may begin requesting the new session. the b-device begins by pulsing the d+ data line. software should do this by setting dppulup (u1otgcon<7>). the data line should be held high for 5 to 10 ms. the b-device then proceeds by pulsing the v bus supply. software should do this by setting puvbus (u1cnfg2<4>). when an a-device detects srp signaling (either via the attachif (u1ir<6>) interrupt or via the sesvdif (u1otgir<3>) interrupt), the a-device must restore the v bus supply by properly configuring the general purpose i/o port pin controlling the external power source. the b-device should not monitor the state of the v bus supply while performing v bus supply pulsing. when the b-device does detect that the v bus supply has been restored (via the sesvdif (u1otgir<3>) interrupt), the b-device must reconnect to the usb link by pulling up d+ or d- (via the dppulup or dmpulup bit). the a-device must complete the srp by driving usb reset signaling. note: usb speed, transceiver and pull-ups should only be configured during the module setup phase. it is not recom- mended to change these settings while the module is enabled. note: when the a-device powers down the v bus supply, the b-device must discon- nect its pull-up resistor from power. if the device is self-powered, it can do this by clearing dppulup (u1otgcon<7>) and dmpulup (u1otgcon<6>). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 277 pic24fj1024ga610/gb610 family 20.6.2 host negotiation protocol (hnp) in usb otg applications, a dual role device (drd) is a device that is capable of being either a host or a peripheral. any otg drd must support host negotiation protocol (hnp). hnp allows an otg b-device to temporarily become the usb host. the a-device must first enable the b-device to follow hnp. refer to the on-the-go supplement to the usb 2.0 specification for more information regarding hnp. hnp may only be initiated at full speed. after being enabled for hnp by the a-device, the b-device requests being the host any time that the usb link is in the suspend state, by simply indicating a dis- connect. this can be done in software by clearing dppulup and dmpulup. when the a-device detects the disconnect condition (via the urstif (u1ir<0>) interrupt), the a-device may allow the b-device to take over as host. the a-device does this by signaling con- nect as a full-speed function. software may accomplish this by setting dppulup. if the a-device responds instead with resume signaling, the a-device remains as host. when the b-device detects the connect condition (via attachif, u1ir<6>), the b-device becomes host. the b-device drives reset signaling prior to using the bus. when the b-device has finished in its role as host, it stops all bus activity and turns on its d+ pull-up resistor by setting dppulup. when the a-device detects a suspend condition (idle for 3 ms), the a-device turns off its d+ pull-up. the a-device may also power down the v bus supply to end the session. when the a-device detects the connect condition (via attachif), the a-device resumes host operation and drives reset signaling. 20.7 usb otg module registers there are a total of 37 memory-mapped registers asso- ciated with the usb otg module. they can be divided into four general categories: usb otg module control (12) usb interrupt (7) usb endpoint management (16) usb v bus power control (2) this total does not include the (up to) 128 bd registers in the bdt. their prototypes, described in register 20-1 and register 20-2 , are shown sepa- rately in section 20.2 usb buffer descriptors and the bdt . all usb otg registers are implemented in the least significant byte (lsb) of the register. bits in the upper byte are unimplemented and have no function. note that some registers are instantiated only in host mode, while other registers have different bit instantiations and functions in device and host modes. the registers described in the following sections are those that have bits with specific control and configura- tion features. the following registers are used for data or address values only: u1bdtp1, u1bdtp2 and u1bdtp3: specifies the 256-word page in data ram used for the bdt; 8-bit value with bit 0 fixed as 0 for boundary alignment. u1frml and u1frmh: contains the 11-bit byte counter for the current data frame. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 278 ? 2015 microchip technology inc. 20.7.1 usb otg module control registers register 20-3: u1otgstat: usb otg st atus register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r-0, hsc u-0 r-0, hsc u-0 r-0, hsc r-0, hsc u-0 r-0, hsc id l s t a t e sesvd sesend vbusvd bit 7 bit 0 legend: u = unimplemented bit, read as 0 r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 id: id pin state indicator bit 1 = no plug is attached or a type b cable has been plugged into the usb receptacle 0 = a type a plug has been plugged into the usb receptacle bit 6 unimplemented: read as 0 bit 5 lstate: line state stable indicator bit 1 = the usb line state (as defined by se0 and jstate) has been stable for the previous 1 ms 0 = the usb line state has not been stable for the previous 1 ms bit 4 unimplemented: read as 0 bit 3 sesvd: session valid indicator bit 1 = the v bus voltage is above v a _ sess _v ld (as defined in the usb 2.0 specification ) on the a or b-device 0 =the v bus voltage is below v a _ sess _v ld on the a or b-device bit 2 sesend: b session end indicator bit 1 = the v bus voltage is below v b _ sess _ end (as defined in the usb 2.0 specification ) on the b-device 0 =the v bus voltage is above v b _ sess _ end on the b-device bit 1 unimplemented: read as 0 bit 0 vbusvd: a v bus valid indicator bit 1 = the v bus voltage is above v a _v bus _v ld (as defined in the usb 2.0 specification ) on the a-device 0 =the v bus voltage is below v a _v bus _v ld on the a-device downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 279 pic24fj1024ga610/gb610 family register 20-4: u1otgcon: usb on-the-go control register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r-0 r/w-0 r-0 r/w-0 dppulup dmpulup dppuldwn ( 1 ) dmpuldwn ( 1 ) o t g e n ( 1 ) vbusdis ( 1 ) bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 dppulup: d+ pull-up enable bit 1 = d+ data line pull-up resistor is enabled 0 = d+ data line pull-up resistor is disabled bit 6 dmpulup: d- pull-up enable bit 1 = d- data line pull-up resistor is enabled 0 = d- data line pull-up resistor is disabled bit 5 dppuldwn: d+ pull-down enable bit ( 1 ) 1 = d+ data line pull-down resistor is enabled 0 = d+ data line pull-down resistor is disabled bit 4 dmpuldwn: d- pull-down enable bit ( 1 ) 1 = d- data line pull-down resistor is enabled 0 = d- data line pull-down resistor is disabled bit 3 reserved: maintain as 0 bit 2 otgen: otg features enable bit ( 1 ) 1 = usb otg is enabled; all d+/d- pull-up and pull-down bits are enabled 0 = usb otg is disabled; d+/d- pull-up and pull-down bits are controlled in hardware by the settings of the hosten and u sben (u1con<3,0>) bits bit 1 reserved: maintain as 0 bit 0 vbusdis: v bus discharge enable bit ( 1 ) 1 =v bus line is discharged through a resistor 0 =v bus line is not discharged note 1: these bits are only used in host mode; do not use in device mode. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 280 ? 2015 microchip technology inc. register 20-5: u1pwrc: usb power control register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r-x, hsc u-0 u-0 r/w-0 u-0 u-0 r/w-0, hc r/w-0 uactpnd uslpgrd ususpnd usbpwr bit 7 bit 0 legend: hc = hardware clearable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 uactpnd: usb activity pending bit 1 = module should not be suspended at the moment (requires the uslpgrd bit to be set) 0 = module may be suspended or powered down bit 6-5 unimplemented: read as 0 bit 4 uslpgrd: usb sleep/suspend guard bit 1 = indicates to the usb module that it is about to be suspended or powered down 0 = no suspend bit 3-2 unimplemented: read as 0 bit 1 ususpnd: usb suspend mode enable bit 1 = usb otg module is in suspend mode; usb clock is gated and the transceiver is placed in a low-power state 0 = normal usb otg operation bit 0 usbpwr: usb operation enable bit 1 = usb otg module is enabled 0 = usb otg module is disabled ( 1 ) note 1: do not clear this bit unless the hosten, usben and otgen bits (u1con<3,0> and u1otgcon<2>) are all cleared. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 281 pic24fj1024ga610/gb610 family register 20-6: u1stat: usb status register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc u-0 u-0 endpt3 endpt2 endpt1 endpt0 dir ppbi ( 1 ) bit 7 bit 0 legend: u = unimplemented bit, read as 0 r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7-4 endpt<3:0>: number of the last endpoint activity bits (represents the number of the bdt updated by the last usb transfer.) 1111 = endpoint 15 1110 = endpoint 14 0001 = endpoint 1 0000 = endpoint 0 bit 3 dir: last bd direction indicator bit 1 = the last transaction was a transmit transfer (tx) 0 = the last transaction was a receive transfer (rx) bit 2 ppbi: ping-pong bd pointer indicator bit ( 1 ) 1 = the last transaction was to the odd bd bank 0 = the last transaction was to the even bd bank bit 1-0 unimplemented: read as 0 note 1: this bit is only valid for endpoints with available even and odd bd registers. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 282 ? 2015 microchip technology inc. register 20-7: u1con: usb cont rol register (device mode) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 r-x, hsc r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 se0 pktdis hosten resume ppbrst usben bit 7 bit 0 legend: u = unimplemented bit, read as 0 r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-7 unimplemented: read as 0 bit 6 se0: live single-ended zero flag bit 1 = single-ended zero is active on the usb bus 0 = no single-ended zero is detected bit 5 pktdis: packet transfer disable bit 1 = sie token and packet processing are disabled; automatically set when a setup token is received 0 = sie token and packet processing are enabled bit 4 unimplemented: read as 0 bit 3 hosten: host mode enable bit 1 = usb host capability is enabled; pull-downs on d+ and d- are activated in hardware 0 = usb host capability is disabled bit 2 resume: resume signaling enable bit 1 = resume signaling is activated 0 = resume signaling is disabled bit 1 ppbrst: ping-pong buffers reset bit 1 = resets all ping-pong buffer pointers to the even bd banks 0 = ping-pong buffer pointers are not reset bit 0 usben: usb module enable bit 1 = usb module and supporting circuitry are enabled (device attached); d+ pull-up is activated in hardware 0 = usb module and supporting circuitry are disabled (device detached) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 283 pic24fj1024ga610/gb610 family register 20-8: u1con: usb control register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r-x, hsc r-x, hsc r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 jstate se0 tokbusy usbrst hosten resume ppbrst sofen bit 7 bit 0 legend: u = unimplemented bit, read as 0 r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 jstate: live differential receiver j-state flag bit 1 = j-state (differential 0 in low speed, differential 1 in full speed) is detected on the usb 0 = no j-state is detected bit 6 se0: live single-ended zero flag bit 1 = single-ended zero is active on the usb bus 0 = no single-ended zero is detected bit 5 tokbusy: token busy status bit 1 = token is being executed by the usb module in on-the-go state 0 = no token is being executed bit 4 usbrst: usb module reset bit 1 = usb reset has been generated for a software reset; application must set this bit for 50 ms, then clear it 0 = usb reset is terminated bit 3 hosten: host mode enable bit 1 = usb host capability is enabled; pull-downs on d+ and d- are activated in hardware 0 = usb host capability is disabled bit 2 resume: resume signaling enable bit 1 = resume signaling is activated; software must set bit for 10 ms and then clear to enable remote wake-up 0 = resume signaling is disabled bit 1 ppbrst: ping-pong buffers reset bit 1 = resets all ping-pong buffer pointers to the even bd banks 0 = ping-pong buffer pointers are not reset bit 0 sofen: start-of-frame enable bit 1 = start-of-frame token is sent every one 1 ms 0 = start-of-frame token is disabled downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 284 ? 2015 microchip technology inc. register 20-9: u1addr: usb address register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 lspden ( 1 ) devaddr6 devaddr5 devaddr4 devaddr3 devaddr2 devaddr1 devaddr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 lspden: low-speed enable indicator bit ( 1 ) 1 = usb module operates at low speed 0 = usb module operates at full speed bit 6-0 devaddr<6:0>: usb device address bits note 1: host mode only. in device mode, this bit is unimplemented and read as 0 . register 20-10: u1tok: usb token register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pid3 pid2 pid1 pid0 ep3 ep2 ep1 ep0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7-4 pid<3:0>: token type identifier bits 1101 = setup (tx) token type transaction ( 1 ) 1001 = in (rx) token type transaction ( 1 ) 0001 = out (tx) token type transaction ( 1 ) bit 3-0 ep<3:0>: token command endpoint address bits this value must specify a valid endpoint on the attached device. note 1: all other combinations are reserved and are not to be used. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 285 pic24fj1024ga610/gb610 family register 20-11: u1sof: usb otg start-of-token threshold register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 cnt<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7-0 cnt<7:0>: start-of-frame size bits value represents 10 + (packet size of n bytes). for example: 0100 1010 = 64-byte packet 0010 1010 = 32-byte packet 0001 0010 = 8-byte packet downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 286 ? 2015 microchip technology inc. register 20-12: u1cnfg1: usb configuration register 1 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 u-0 u-0 r/w-0 r/w-0 uteye uoemon ( 1 ) usbsidl ppb1 ppb0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 uteye: usb eye pattern test enable bit 1 = eye pattern test is enabled 0 = eye pattern test is disabled bit 6 uoemon: usb oe monitor enable bit ( 1 ) 1 =oe signal is active; it indicates intervals during which the d+/d- lines are driving 0 =oe signal is inactive bit 5 unimplemented: read as 0 bit 4 usbsidl: usb otg stop in idle mode bit 1 = discontinues module operation when the device enters idle mode 0 = continues module operation in idle mode bit 3-2 unimplemented: read as 0 bit 1-0 ppb<1:0>: ping-pong buffers configuration bits 11 = even/odd ping-pong buffers are enabled for endpoints 1 to 15 10 = even/odd ping-pong buffers are enabled for all endpoints 01 = even/odd ping-pong buffers are enabled for rx endpoint 0 00 = even/odd ping-pong buffers are disabled note 1: this bit is only active when the utrdis bit (u1cnfg2<0>) is set. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 287 pic24fj1024ga610/gb610 family register 20-13: u1cnfg2: usb configuration register 2 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 u-0 u-0 u-0 puvbus exti2cen bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-5 unimplemented: read as 0 bit 4 puvbus: v bus pull-up enable bit 1 = pull-up on v bus pin is enabled 0 = pull-up on v bus pin is disabled bit 3 exti2cen: i 2 c interface for external module control enable bit 1 = external module(s) is controlled via the i 2 c interface 0 = external module(s) is controlled via the dedicated pins bit 2-0 unimplemented: read as 0 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 288 ? 2015 microchip technology inc. 20.7.2 usb interrupt registers register 20-14: u1otgir: usb otg interrup t status register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs u-0 r/k-0, hs idif t1msecif lstateif actvif sesvdif sesendif vbusvdif bit 7 bit 0 legend: hs = hardware settable bit r = readable bit k = write 1 to clear bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 idif: id state change indicator bit 1 = change in id state is detected 0 = no id state change is detected bit 6 t1msecif: 1 millisecond timer bit 1 = the 1 millisecond timer has expired 0 = the 1 millisecond timer has not expired bit 5 lstateif: line state stable indicator bit 1 = usb line state (as defined by the se0 and jstate bits) has been stable for 1 ms, but different from the last time 0 = usb line state has not been stable for 1 ms bit 4 actvif: bus activity indicator bit 1 = activity on the d+/d- lines or v bus is detected 0 = no activity on the d+/d- lines or v bus is detected bit 3 sesvdif: session valid change indicator bit 1 =v bus has crossed v a _ sess _ end (as defined in the usb 2.0 specification ) ( 1 ) 0 =v bus has not crossed v a _ sess _ end bit 2 sesendif: b-device v bus change indicator bit 1 =v bus change on b-device is detected; v bus has crossed v b _ sess _ end (as defined in the usb 2.0 specification ) ( 1 ) 0 =v bus has not crossed v b _ sess _ end bit 1 unimplemented: read as 0 bit 0 vbusvdif: a-device v bus change indicator bit 1 =v bus change on a-device is detected; v bus has crossed v a _v bus _v ld (as defined in the usb 2.0 specification ) ( 1 ) 0 =no v bus change on a-device is detected note 1: v bus threshold crossings may either be rising or falling. note: individual bits can only be cleared by writing a 1 to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will ca use all set bits, at the moment of the write, to become cleared. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 289 pic24fj1024ga610/gb610 family register 20-15: u1otgie: usb otg interrup t enable register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 idie t1msecie lstateie actvie sesvdie sesendie vbusvdie bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 idie: id interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 6 t1msecie: 1 millisecond timer interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 5 lstateie: line state stable interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 4 actvie: bus activity interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 3 sesvdie: session valid interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 2 sesendie: b-device session end interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 1 unimplemented: read as 0 bit 0 vbusvdie: a-device v bus valid interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 290 ? 2015 microchip technology inc. register 20-16: u1ir: usb interrupt st atus register (device mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/k-0, hs u-0 r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs stallif resumeif idleif trnif sofif uerrif urstif bit 7 bit 0 legend: u = unimplemented bit, read as 0 r = readable bit k = write 1 to clear bit hs = hardware settable bit -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 stallif: stall handshake interrupt bit 1 = a stall handshake was sent by the peripheral during the handshake phase of the transaction in device mode 0 = a stall handshake has not been sent bit 6 unimplemented: read as 0 bit 5 resumeif: resume interrupt bit 1 = a k-state is observed on the d+ or d- pin for 2.5 ? s (differential 1 for low speed, differential 0 for full speed) 0 = no k-state is observed bit 4 idleif: idle detect interrupt bit 1 = idle condition is detected (constant idle state of 3 ms or more) 0 = no idle condition is detected bit 3 trnif: token processing complete interrupt bit 1 = processing of the current token is complete; read the u1stat register for endpoint information 0 = processing of the current token is not complete; clear the u1stat register or load the next to ken from stat (clearing this bit causes the stat fifo to advance) bit 2 sofif: start-of-frame token interrupt bit 1 = a start-of-frame token is received by the peripheral or the start-of-frame threshold is reached by the host 0 = no start-of-frame token is received or threshold reached bit 1 uerrif : usb error condition interrupt bit 1 = an unmasked error condition has occurred; only error states enabled in the u1eie register can set this bit 0 = no unmasked error condition has occurred bit 0 urstif: usb reset interrupt bit 1 = valid usb reset has occurred for at least 2.5 ? s; reset state must be cleared before this bit can be reasserted 0 = no usb reset has occurred; individual bits can only be cleared by writing a 1 to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise oper- ations to write to a single bit position will cause all set bits, at the moment of the write, to become cleared note: individual bits can only be cleared by writing a 1 to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will ca use all set bits, at the moment of the write, to become cleared. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 291 pic24fj1024ga610/gb610 family register 20-17: u1ir: usb interrupt status register (host mode only) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs stallif attachif resumeif idleif trnif sofif uerrif detachif bit 7 bit 0 legend: u = unimplemented bit, read as 0 r = readable bit k = write 1 to clear bit hs = hardware settable bit -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 stallif: stall handshake interrupt bit 1 = a stall handshake was sent by the peripheral device during the handshake phase of the transaction in device mode 0 = a stall handshake has not been sent bit 6 attachif: peripheral attach interrupt bit 1 = a peripheral attachment has been detected by the module; it is set if the bus state is not se0 and there has been no bus activity for 2.5 ? s 0 = no peripheral attachment has been detected bit 5 resumeif: resume interrupt bit 1 = a k-state is observed on the d+ or d- pin for 2.5 ? s (differential 1 for low speed, differential 0 for full speed) 0 = no k-state is observed bit 4 idleif: idle detect interrupt bit 1 = idle condition is detected (constant idle state of 3 ms or more) 0 = no idle condition is detected bit 3 trnif: token processing complete interrupt bit 1 = processing of the current token is complete; read the u1stat register for endpoint information 0 = processing of the current token is not complete; clear the u1stat register or load the next token from u1stat bit 2 sofif: start-of-frame token interrupt bit 1 = a start-of-frame token is received by the peripheral or the start-of-frame threshold is reached by the host 0 = no start-of-frame token is received or threshold reached bit 1 uerrif: usb error condition interrupt bit 1 = an unmasked error condition has occurred; only error states enabled in the u1eie register can set this bit 0 = no unmasked error condition has occurred bit 0 detachif: detach interrupt bit 1 = a peripheral detachment has been detected by the module; reset state must be cleared before this bit can be re-asserted 0 = no peripheral detachment is detected. individual bits can only be cleared by writing a 1 to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will cause all set bits, at the moment of the write, to become cleared. note: individual bits can only be cleared by writing a 1 to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will ca use all set bits, at the moment of the write, to become cleared. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 292 ? 2015 microchip technology inc. register 20-18: u1ie: usb interrupt enable register (all usb modes) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 stallie attachie ( 1 ) resumeie idleie trnie sofie uerrie urstie detachie bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 stallie: stall handshake interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 6 attachie: peripheral attach interrupt bit (host mode only) ( 1 ) 1 = interrupt is enabled 0 = interrupt is disabled bit 5 resumeie: resume interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 4 idleie: idle detect interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 3 trnie: token processing complete interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 2 sofie: start-of-frame token interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 1 uerrie: usb error condition interrupt bit 1 = interrupt is enabled 0 = interrupt is disabled bit 0 urstie or detachie: usb reset interrupt (device mode) or usb detach interrupt (host mode) enable bit 1 = interrupt is enabled 0 = interrupt is disabled note 1: this bit is unimplemented in device mode, read as 0 . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 293 pic24fj1024ga610/gb610 family register 20-19: u1eir: usb error interrupt status register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/k-0, hs u-0 r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs r/k-0, hs btsef dmaef btoef dfn8ef crc16ef crc5ef pidef eofef bit 7 bit 0 legend: u = unimplemented bit, read as 0 r = readable bit k = write 1 to clear bit hs = hardware settable bit -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 btsef: bit stuff error flag bit 1 = bit stuff error has been detected 0 = no bit stuff error has been detected bit 6 unimplemented: read as 0 bit 5 dmaef: dma error flag bit 1 = a usb dma error condition is detected; the data size indicated by the bd byte count field is less than the number of received bytes, the received data is truncated 0 = no dma error bit 4 btoef: bus turnaround time-out error flag bit 1 = bus turnaround time-out has occurred 0 = no bus turnaround time-out has occurred bit 3 dfn8ef: data field size error flag bit 1 = data field was not an integral number of bytes 0 = data field was an integral number of bytes bit 2 crc16ef: crc16 failure flag bit 1 = crc16 failed 0 = crc16 passed bit 1 for device mode: crc5ef: crc5 host error flag bit 1 = token packet is rejected due to crc5 error 0 = token packet is accepted (no crc5 error) for host mode: eofef: end-of-frame (eof) error flag bit 1 = end-of-frame error has occurred 0 = end-of-frame interrupt is disabled bit 0 pidef: pid check failure flag bit 1 = pid check failed 0 = pid check passed note: individual bits can only be cleared by writing a 1 to the bit position as part of a word write operation on the entire register. using boolean instructions or bitwise operations to write to a single bit position will ca use all set bits, at the moment of the write, to become cleared. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 294 ? 2015 microchip technology inc. register 20-20: u1eie: usb error interrupt enable register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 btsee dmaee btoee dfn8ee crc16ee crc5ee pidee eofee bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 btsee: bit stuff error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 6 unimplemented: read as 0 bit 5 dmaee: dma error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 4 btoee: bus turnaround time-out error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 3 dfn8ee: data field size error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 2 crc16ee: crc16 failure interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 1 for device mode: crc5ee: crc5 host error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled for host mode: eofee: end-of-frame (eof) error interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled bit 0 pidee: pid check failure interrupt enable bit 1 = interrupt is enabled 0 = interrupt is disabled downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 295 pic24fj1024ga610/gb610 family 20.7.3 usb endpoint management registers register 20-21: u1epn: usb endpoint n control registers (n = 0 to 15) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 lspd ( 1 ) retrydis ( 1 ) epcondis eprxen eptxen epstall ephshk bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 unimplemented: read as 0 bit 7 lspd: low-speed direct connection enable bit (u1ep0 only) ( 1 ) 1 = direct connection to a low-speed device is enabled 0 = direct connection to a low-speed device is disabled bit 6 retrydis: retry disable bit (u1ep0 only) ( 1 ) 1 = retry nak transactions are disabled 0 = retry nak transactions are enabled; retry is done in hardware bit 5 unimplemented: read as 0 bit 4 epcondis: bidirectional endpoint control bit if eptxen and eprxen = 1 : 1 = disables endpoint n from control transfers; only tx and rx transfer s are allowed 0 = enables endpoint n for control (setup) transfers; tx and rx transfers are also allowed for all other combinations of eptxen and eprxen: this bit is ignored. bit 3 eprxen: endpoint receive enable bit 1 = endpoint n receive is enabled 0 = endpoint n receive is disabled bit 2 eptxen: endpoint transmit enable bit 1 = endpoint n transmit is enabled 0 = endpoint n transmit is disabled bit 1 epstall: endpoint stall status bit 1 = endpoint n was stalled 0 = endpoint n was not stalled bit 0 ephshk: endpoint handshake enable bit 1 = endpoint handshake is enabled 0 = endpoint handshake is disabled (typically used for isochronous e ndpoints) note 1: these bits are available only for u1ep0 and only in host mode. for all other u1epn registers, these bits are always unimplemented and read as 0 . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 296 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 297 pic24fj1024ga610/gb610 family 21.0 enhanced parallel master port (epmp) the enhanced parallel master port (epmp) module pro- vides a parallel, 4-bit (master mode only), 8-bit (master and slave modes) or 16-bit (master mode only) data bus interface to communicate with off-chip modules, such as memories, fifos, lcd controllers and other micro- controllers. this module can serve as either the master or the slave on the communication bus. for epmp master modes, all external addresses are mapped into the internal extended data space (eds). this is done by allocating a region of the eds for each chip select, and then assigning each chip select to a particular external resource, such as a memory or external controller. this region should not be assigned to another device resource, such as ram or sfrs. to perform a write or read on an external resource, the cpu simply performs a write or read within the address range assigned for the epmp. key features of the epmp module are: extended data space (eds) interface allows direct access from the cpu up to 23 programmable address lines up to 2 chip select lines up to 2 acknowledgment lines (one per chip select) 4-bit, 8-bit or 16-bit wide data bus programmable strobe options (per chip select): - individual read and write strobes or; - read/write strobe with enable strobe programmable address/data multiplexing programmable address wait states programmable data wait states (per chip select) programmable polarity on control signals (per chip select) legacy parallel slave port support enhanced parallel slave support: - address support - 4-byte deep auto-incrementing buffer 21.1 specific package variations while all pic24fj1024ga610/gb610 family devices implement the epmp, i/o pin constraints place some limits on 16-bit master mode operations in some pack- age types. this is reflected in the number of dedicated chip select pins implemented and the number of dedi- cated address lines that are available. the differences are summarized in table 21-1 . all available epmp pin functions are summarized in tab l e 2 1- 2 . for 64-pin devices, the dedicated chip select pins (pmcs1 and pmcs2) are not implemented. in addi- tion, only 16 address lines (pma<15:0>) are available. if required, pma14 and pma15 can be remapped to function as pmcs1 and pmcs2, respectively. the memory space addressable by the device depends on the number of address lines available, as well as the number of chip select signals required for the application. devices with lower pin counts are more affected by chip select requirements, as these take away address lines. table 21-1 shows the maximum addressable range for each pin count. 21.2 pmdout1 and pmdout2 registers the epmp data output 1 and data output 2 registers are used only in slave mode for buffered output data. these registers act as a buffer for outgoing data. 21.3 pmdin1 and pmdin2 registers the epmp data input 1 and data input 2 registers are used in slave modes to buffer incoming data. these registers hold data that is asynchronously clocked in. in master mode, pmdin1 is the holding register for incoming data. table 21-1: epmp feature differences by device pin count note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference manual , enhanced parallel master port (epmp) (ds39730), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. device dedicated chip select address lines data lines address range (bytes) cs1 cs2 no cs 1 cs ( 1 ) 2 cs ( 1 ) pic24fjxxxgx606 (64-pin) 16 8 64k 32k 16k pic24fjxxxgx610 (100-pin/121-pin) x x 23 16 16m note 1: pma14 and pma15 can be remapped to be dedicated chip selects. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 298 ? 2015 microchip technology inc. table 21-2: enhanced parallel master port pin descriptions pin name (alternate function) type description pma<22:16> o address bus bits<22:16> pma15 o address bus bit 15 i/o data bus bit 15 (16-bit port with multiplexed addressing) (pmcs2) o chip select 2 (alternate location) pma14 o address bus bit 14 i/o data bus bit 14 (16-bit port with multiplexed addressing) (pmcs1) o chip select 1 (alternate location) pma<13:8> o address bus bits<13:8> i/o data bus bits<13:8> (16-bit port with multiplexed addressing) pma<7:3> o address bus bits<7:3> pma2 (pmalu) o address bus bit 2 o address latch upper strobe for multiplexed address pma1 (pmalh) i/o address bus bit 1 o address latch high strobe for multiplexed address pma0 (pmall) i/o address bus bit 0 o address latch low strobe for multiplexed address pmd<15:8> i/o data bus bits<15:8> (demultiplexed addressing) pmd<7:4> i/o data bus bits<7:4> o address bus bits<7:4> (4-bit port with 1-phase multiplexed addressing) pmd<3:0> i/o data bus bits<3:0> pmcs1 ( 1 ) o chip select 1 pmcs2 ( 1 ) o chip select 2 pmwr i/o write strobe ( 2 ) (pmenb) i/o enable signal ( 2 ) pmrd i/o read strobe ( 2 ) (pmrd/pmwr) i/o read/write signal ( 2 ) pmbe1 o byte indicator pmbe0 o nibble or byte indicator pmack1 i acknowledgment signal 1 pmack2 i acknowledgment signal 2 note 1: these pins are implemented in 100-pin and 121-pin devices only. 2: signal function depends on the setting of the mode<1:0> and sm bits (pmcon1<9:8> and pmcsxcf<8>). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 299 pic24fj1024ga610/gb610 family register 21-1: pmcon1: ep mp control register 1 r/w-0 u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 pmpen psidl adrmux1 adrmux0 m o d e 1m o d e 0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 csf1 csf0 alp almode buskeep irqm1 irqm0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 pmpen: parallel master port enable bit 1 = epmp is enabled 0 = epmp is disabled bit 14 unimplemented: read as 0 bit 13 psidl: parallel master port stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-11 adrmux<1:0>: address/data multiplexing selection bits 11 = lower address bits are multiplexed with data bits using 3 address phases 10 = lower address bits are multiplexed with data bits using 2 address phases 01 = lower address bits are multiplexed with data bits using 1 address phase 00 = address and data appear on separate pins bit 10 unimplemented: read as 0 bit 9-8 mode<1:0>: parallel port mode select bits 11 = master mode 10 = enhanced psp; pins used are pmrd, pmwr, pmcs, pmd<7:0> and pma<1:0> 01 = buffered psp; pins used are pmrd, pmwr, pmcs and pmd<7:0> 00 = legacy parallel slave port; pins used are pmrd, pmwr, pmcs and pmd<7:0> bit 7-6 csf<1:0>: chip select function bits 11 = reserved 10 = pma15 is used for chip select 2, pma14 is used for chip select 1 01 = pma15 is used for chip select 2, pmcs1 is used for chip select 1 00 = pmcs2 is used for chip select 2, pmcs1 is used for chip select 1 bit 5 alp: address latch polarity bit 1 = active-high (pmall, pmalh and pmalu) 0 = active-low (pmall , pmalh and pmalu ) bit 4 almode: address latch strobe mode bit 1 = enables smart address strobes (each address phase is only present if the current access would cause a different address in the latch than the previous address) 0 = disables smart address strobes bit 3 unimplemented: read as 0 bit 2 buskeep: bus keeper bit 1 = data bus keeps its last value when not actively being driven 0 = data bus is in a high-impedance state when not actively being driven bit 1-0 irqm<1:0>: interrupt request mode bits 11 = interrupt is generated when read buffer 3 is read or write buffer 3 is written (buffered psp mode), or on a read or write operation when pma<1:0> = 11 (addressable psp mode only) 10 = reserved 01 = interrupt is generated at the end of a read/write cycle 00 = no interrupt is generated downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 300 ? 2015 microchip technology inc. register 21-2: pmcon2: ep mp control register 2 r-0, hsc u-0 r/c-0, hs r/c-0, hs u-0 u-0 u-0 u-0 busy error timeout bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 raddr23 ( 1 ) raddr22 ( 1 ) raddr21 ( 1 ) raddr20 ( 1 ) raddr19 ( 1 ) raddr18 ( 1 ) raddr17 ( 1 ) raddr16 ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown c = clearable bit hs = hardware settable bit hsc = hardware settable/clearab le bit bit 15 busy: busy bit (master mode only) 1 = port is busy 0 = port is not busy bit 14 unimplemented: read as 0 bit 13 error: error bit 1 = transaction error (illegal transaction was requested) 0 = transaction completed successfully bit 12 timeout: time-out bit 1 = transaction timed out 0 = transaction completed successfully bit 11-8 unimplemented: read as 0 bit 7-0 raddr<23:16>: parallel master port reserved address space bits ( 1 ) note 1: if raddr<23:16> = 00000000 , then the last eds address for chip select 2 will be ffffffh. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 301 pic24fj1024ga610/gb610 family register 21-3: pmcon3: ep mp control register 3 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 ptwren ptrden ptbe1en ptbe0en awaitm1 awaitm0 awaite bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 ptwren: write/enable strobe port enable bit 1 = pmwr/pmenb port is enabled 0 = pmwr/pmenb port is disabled bit 14 ptrden: read/write strobe port enable bit 1 = pmrd/pmwr port is enabled 0 = pmrd/pmwr port is disabled bit 13 ptbe1en: high nibble/byte enable port enable bit 1 = pmbe1 port is enabled 0 = pmbe1 port is disabled bit 12 ptbe0en: low nibble/byte enable port enable bit 1 = pmbe0 port is enabled 0 = pmbe0 port is disabled bit 11 unimplemented: read as 0 bit 10-9 awaitm<1:0>: address latch strobe wait states bits 11 = wait of 3? t cy 10 = wait of 2? t cy 01 = wait of 1? t cy 00 = wait of ? t cy bit bit 8 awaite: address hold after address latch strobe wait states bits 1 = wait of 1? t cy 0 = wait of ? t cy bit 7-0 unimplemented: read as 0 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 302 ? 2015 microchip technology inc. register 21-4: pmcon4: ep mp control register 4 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pten15 pten14 pten<13:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pten<7:3> pten<2:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 pten15: pma15 port enable bit 1 = pma15 functions as either address line 15 or chip select 2 0 = pma15 functions as port i/o bit 14 pten14: pma14 port enable bit 1 = pma14 functions as either address line 14 or chip select 1 0 = pma14 functions as port i/o bit 13-3 pten<13:3>: epmp address port enable bits 1 = pma<13:3> function as epmp address lines 0 = pma<13:3> function as port i/os bit 2-0 pten<2:0>: pmalu/pmalh/pmall strobe enable bits 1 = pma<2:0> function as either address lines or address latch strobes 0 = pma<2:0> function as port i/os downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 303 pic24fj1024ga610/gb610 family register 21-5: pmcsxcf: epmp chip select x configuration register r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 csdis csp cspten bep wrsp rdsp sm bit 15 bit 8 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 u-0 ackp ptsz1 ptsz0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 csdis: chip select x disable bit 1 = disables the chip select x functionality 0 = enables the chip select x functionality bit 14 csp: chip select x polarity bit 1 = active-high (pmcsx) 0 =active-low (pmcsx ) bit 13 cspten: pmcsx port enable bit 1 = pmcsx port is enabled 0 = pmcsx port is disabled bit 12 bep: chip select x nibble/byte enable polarity bit 1 = nibble/byte enable is active-high (pmbe0, pmbe1) 0 = nibble/byte enable is active-low (pmbe0 , pmbe1 ) bit 11 unimplemented: read as 0 bit 10 wrsp: chip select x write strobe polarity bit for slave modes and master mode when sm = 0 : 1 = write strobe is active-high (pmwr) 0 = write strobe is active-low (pmwr ) for master mode when sm = 1 : 1 = enable strobe is active-high (pmenb) 0 = enable strobe is active-low (pmenb ) bit 9 rdsp: chip select x read strobe polarity bit for slave modes and master mode when sm = 0 : 1 = read strobe is active-high (pmrd) 0 = read strobe is active-low (pmrd ) for master mode when sm = 1 : 1 = read/write strobe is active-high (pmrd/pmwr ) 0 = read/write strobe is active-low (pmrd /pmwr) bit 8 sm: chip select x strobe mode bit 1 = reads/writes and enables strobes (pmrd/pmwr and pmenb) 0 = reads and writes strobes (pmrd and pmwr) bit 7 ackp: chip select x acknowledge polarity bit 1 = ack is active-high (pmack1) 0 = ack is active-low (pmack1 ) bit 6-5 ptsz<1:0>: chip select x port size bits 11 = reserved 10 = 16-bit port size (pmd<15:0>) 01 = 4-bit port size (pmd<3:0>) 00 = 8-bit port size (pmd<7:0>) bit 4-0 unimplemented: read as 0 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 304 ? 2015 microchip technology inc. register 21-6: pmcsxbs: epmp chip select x base address register ( 2 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) r/w ( 1 ) base<23:16> bit 15 bit 8 r/w ( 1 ) u-0 u-0 u-0 r/w ( 1 ) u-0 u-0 u-0 base15 base11 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-7 base<23:15>: chip select x base address bits ( 1 ) bit 6-4 unimplemented: read as 0 bit 3 base11: chip select x base address bit ( 1 ) bit 2-0 unimplemented: read as 0 note 1: the value at por is 0080h for pmcs1bs and 8080h for pmcs2bs. 2: if the whole pmcs2bs register is written together as 0x0000, then the last eds address for the chip select 1 will be ffffffh. in this case, chip select 2 should not be used. pmcs1bs has no such feature. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 305 pic24fj1024ga610/gb610 family register 21-7: pmcsxmd: epmp chip select x mode register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 ackm1 ackm0 amwait2 amwait1 amwait0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 dwaitb1 dwaitb0 dwaitm3 dwaitm2 dwaitm1 dwaitm0 dwaite1 dwaite0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 ackm<1:0>: chip select x acknowledge mode bits 11 = reserved 10 = pmackx is used to determine when a read/write operation is complete 01 = pmackx is used to determine when a read/write operation is complete with time-out (if dwaitm<3:0> = 0000 , the maximum time-out is 255 t cy or else it is dwaitm<3:0> cycles.) 00 = pmackx is not used bit 13-11 amwait<2:0>: chip select x alternate master wait states bits 111 = wait of 10 alternate master cycles . . . 001 = wait of 4 alternate master cycles 000 = wait of 3 alternate master cycles bit 10-8 unimplemented: read as 0 bit 7-6 dwaitb<1:0>: chip select x data setup before read/write strobe wait states bits 11 = wait of 3? t cy 10 = wait of 2? t cy 01 = wait of 1? t cy 00 = wait of ? t cy bit 5-2 dwaitm<3:0>: chip select x data read/write strobe wait states bits for write operations: 1111 = wait of 15? t cy . . . 0001 = wait of 1? t cy 0000 = wait of ? t cy for read operations: 1111 = wait of 15? t cy . . . 0001 = wait of 1? t cy 0000 = wait of ? t cy bit 1-0 dwaite<1:0>: chip select x data hold after read/write strobe wait states bits for write operations: 11 = wait of 3? t cy 10 = wait of 2? t cy 01 = wait of 1? t cy 00 = wait of ? t cy for read operations: 11 = wait of 3 t cy 10 = wait of 2 t cy 01 = wait of 1 t cy 00 = wait of 0 t cy downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 306 ? 2015 microchip technology inc. register 21-8: pmstat: epmp status register (slave mode only) r-0, hsc r/w-0, hs u-0 u-0 r-0, hsc r-0, hsc r-0, hsc r-0, hsc ibf ibov i b 3 f ( 1 ) ib2f ( 1 ) ib1f ( 1 ) ib0f ( 1 ) bit 15 bit 8 r-1, hsc r/w-0, hs u-0 u-0 r-1, hsc r-1, hsc r-1, hsc r-1, hsc obe obuf ob3e ob2e ob1e ob0e bit 7 bit 0 legend: hs = hardware settable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 ibf: input buffer full status bit 1 = all writable input buffer registers are full 0 = some or all of the writable input buffer registers are empty bit 14 ibov: input buffer overflow status bit 1 = a write attempt to a full input register occurred (must be cleared in software) 0 = no overflow occurred bit 13-12 unimplemented: read as 0 bit 11-8 ib3f:ib0f: input buffer x status full bits ( 1 ) 1 = input buffer contains unread data (reading the buffer will clear this bit) 0 = input buffer does not contain unread data bit 7 obe: output buffer empty status bit 1 = all readable output buffer registers are empty 0 = some or all of the readable output buffer registers are full bit 6 obuf: output buffer underflow status bit 1 = a read occurred from an empty output buffer register (must be cleare d in software) 0 = no underflow occurred bit 5-4 unimplemented: read as 0 bit 3-0 ob3e:ob0e: output buffer x status empty bit 1 = output buffer x is empty (writing data to the buffer will clear this bit) 0 = output buffer x contains untransmitted data note 1: even though an individual bit represents the byte in the buffer, the bits corresponding to the word (byte 0 and 1, or byte 2 and 3) get cleared, even on byte reading. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 307 pic24fj1024ga610/gb610 family register 21-9: padcon: pad co nfiguration control register r/w-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 iocon bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 p m p t t l bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 iocon: used for non-pmp functionality bit 14-1 unimplemented: read as 0 bit 0 pmpttl: epmp module ttl input buffer select bit 1 = epmp module inputs (pmdx, pmcs1) use ttl input buffers 0 = epmp module inputs use schmitt trigger input buffers downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 308 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 309 pic24fj1024ga610/gb610 family 22.0 real-time clock and calendar (rtcc) with timestamp the rtcc provides the user with a real-time clock and calendar (rtcc) function that can be calibrated. key features of the rtcc module are: selectable clock source provides hours, minutes and seconds using 24-hour format visibility of one half second period provides calendar C weekday, date, month and year alarm-configurable for half a second, 1 second, 10 seconds, 1 minute, 10 minutes, 1 hour, 1 day, 1 week, 1 month or 1 year alarm repeat with decrementing counter alarm with indefinite repeat chime year 2000 to 2099 leap year correction bcd format for smaller software overhead optimized for long-term battery operation user calibration of the 32.768 khz clock crystal/ 32k intrc frequency with periodic auto-adjust fractional second synchronization calibration to within 2.64 seconds error per month calibrates up to 260 ppm of crystal error ability to periodically wake-up external devices without cpu intervention (external power control) power control output for external circuit control calibration takes effect every 15 seconds timestamp capture register for time and date programmable prescaler and clock divider circuit allows operation with any clock source up to 32 mhz, including 32.768 khz crystal, 50/60 hz powerline clock, external real-time clock (rtc) or 31.25 khz lprc clock 22.1 rtcc source clock the rtcc clock divider block converts the incoming oscillator source into accurate 1/2 and 1 second clocks for the rtcc. the clock divider is optimized to work with three different oscillator sources: 32.768 khz crystal oscillator 31 khz low-power rc oscillator (lprc) external 50 hz or 60 hz powerline frequency an asynchronous prescaler, ps<1:0> (rtccon2l<5:4>), is provided that allows the rtcc to work with higher speed clock sources, such as the system clock. divide ratios of 1:16, 1:64 or 1:256 may be selected, allowing sources up to 32 mhz to clock the rtcc. 22.1.1 coarse frequency division the clock divider block has a 16-bit counter used to divide the input clock frequency. the divide ratio is set by the div<15:0> register bits (rtccon2h<15:0>). the div<15:0> bits should be programmed with a value to produce a nominal 1/2 second clock divider count period. 22.1.2 fine frequency division the fine frequency division is set using the fdiv<4:0> (rtccon2l<15:11>) bits. increasing the fdivx value will lengthen the overall clock divider period. if fdiv<4:0> = 00000 , the fine frequency division circuit is effectively disabled. otherwise, it will optionally remove a clock pulse from the input of the clock divider every 1/2 second. this functionality will allow the user to remove up to 31 pulses over a fixed period of 16 seconds, depending on the value of fdivx. the value for div<15:0> is calculated as shown in equation 22-1 . the fractional remainder of the div<15:0> calculation result can be used to calculate the value for fdiv<4:0>. equation 22-1: rtcc clock divider output frequency note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information on the real-time clock and calendar, refer to the dspic33/pic24 family reference manual , rtcc with timestamp (ds70005193), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. the div<15:0> value is the integer part of this calculation: the fdiv<4:0> value is the fractional part of the div<15:0> calculation multiplied by 32. f out = f in 2 ( ps <1:0> prescaler ) ( div <15:0> + 1) + fdiv <4:0> 32 () div <15:0> = f in 2 ( ps <1:0> prescaler ) C 1 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 310 ? 2015 microchip technology inc. figure 22-1: rtcc block diagram rtcc rtcoe pin clksel<1:0> alarm registers comparators power control repeat control time/date registers timestamp time/ date registers pc<1:0> pwcps<1:0> 1/2 second outsel<2:0> clock divider downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 311 pic24fj1024ga610/gb610 family 22.2 rtcc module registers the rtcc module registers are organized into four categories: rtcc control registers rtcc value registers alarm value registers timestamp registers 22.2.1 register mapping previous rtcc implementations used a register pointer to access the rtcc time and date registers, as well as the alarm time and date registers. these registers are now mapped to memory and are individually addressable. 22.2.2 write lock in order to perform a write to any of the rtcc timer registers, the wrlock bit (rtccon1l<11>) must be set (see example 22-1 ). 22.2.3 selecting rtcc clock source the clock source for the rtcc module can be selected using the clksel<1:0> bits in the rtccon2l register. when the bits are set to 00 , the secondary oscillator (sosc) is used as the reference clock and when the bits are 01 , lprc is used as the reference clock. when clksel<1:0> = 10 , the external power- line (50 hz and 60 hz) is used as the clock source. when clksel<1:0> = 11 , the system clock is used as the clock source. example 22-1: setting the wrlock bit note: to avoid accidental writes to the timer, it is recommended that the wrlock bit (rtccon1l<11>) is kept clear at any other time. for the wrlock bit to be set, there is only one instruction cycle time window allowed between the 55h/aa sequence and the setting of wrlock; therefore, it is recommended that code follow the procedure in example 22-1 . asm volatile(push w7);asm volatile(push w8); asm volatile(disi #5); asm volatile(mov #0x55, w7); asm volatile(mov w7, _nvmkey); asm volatile(mov #0xaa, w8); asm volatile(mov w8, _nvmkey); asm volatile(bset _rtccon1l, #11); //set the wrlock bit asm volatile(pop w8); asm volatile(pop w7); downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 312 ? 2015 microchip technology inc. 22.3 registers 22.3.1 rtcc control registers register 22-1: rtccon1l: rtcc control register 1 (low) r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 rtcen wrlock pwcen pwcpol pwcpoe bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 r/w-0 rtcoe outsel2 outsel1 outsel0 tsaen bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 rtcen: rtcc enable bit 1 = rtcc is enabled and counts from selected clock source 0 = rtcc is not enabled bit 14-12 unimplemented: read as 0 bit 11 wrlock: rtcc register write lock 1 = rtcc registers are locked 0 = rtcc registers may be written to by user bit 10 pwcen: power control enable bit 1 = power control is enabled 0 = power control is disabled bit 9 pwcpol: power control polarity bit 1 = power control output is active-high 0 = power control output is active-low bit 8 pwcpoe: power control output enable bit 1 = power control output pin is enabled 0 = power control output pin is disabled bit 7 rtcoe: rtcc output enable bit 1 = rtcc output is enabled 0 = rtcc output is disabled bit 6-4 outsel<2:0>: rtcc output signal selection bits 111 = unused 110 = unused 101 = unused 100 = timestamp a event 011 = power control 010 = rtcc input clock 001 = second clock 000 = alarm event bit 3-1 unimplemented: read as 0 bit 0 tsaen: timestamp a enable bit 1 = timestamp event will occur when a low pulse is detected on the tmpr pin 0 = timestamp is disabled downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 313 pic24fj1024ga610/gb610 family register 22-2: rtccon1h: rtcc control register 1 (high) r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 alrmen chime amask3 amask2 amask1 amask0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 almrpt7 almrpt6 almrpt5 almrpt4 almrpt3 almrpt2 almrpt1 almrpt0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 alrmen: alarm enable bit 1 = alarm is enabled (cleared automatically after an alarm event whenever almrpt<7:0> = 00h and chime = 0 ) 0 = alarm is disabled bit 14 chime: chime enable bit 1 = chime is enabled; almrpt<7:0> bits roll over from 00h to ffh 0 = chime is disabled; almrpt<7:0> bits stop once they reach 00h bit 13-12 unimplemented: read as 0 bit 11-8 amask<3:0>: alarm mask configuration bits 0000 = every half second 0000 = every second 0010 = every 10 seconds 0011 = every minute 0100 = every 10 minutes 0101 = every hour 0110 = once a day 0111 = once a week 1000 = once a month 1001 = once a year (except when configured for february 29th, once every 4 years) 101x = reserved C do not use 11xx = reserved C do not use bit 7-0 almrpt<7:0>: alarm repeat counter value bits 11111111 = alarm will repeat 255 more times 00000000 = alarm will repeat 0 more times the counter decrements on any alarm event. the counter is prevented from rolling over from 00 to ff unless chime = 1 . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 314 ? 2015 microchip technology inc. register 22-3: rtccon2l: rtcc control register 2 (low) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 fdiv4 fdiv3 fdiv2 fdiv1 fdiv0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 pwcps1 pwcps0 ps1 ps0 clksel1 clksel0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-11 fdiv<4:0>: fractional clock divide bits 00000 = no fractional clock division. 00001 = increase period by 1 rtcc input clock cycle every 16 seconds 00010 = increase period by 2 rtcc input clock cycles every 16 seconds 11101 = increase period by 30 rtcc input clock cycles every 16 seconds 11111 = increase period by 31 rtcc input clock cycles every 16 seconds bit 10-8 unimplemented: read as 0 bit 7-6 pwcps<1:0>: power control prescale select bits 00 = 1:1 01 = 1:16 10 = 1:64 11 = 1:256 bit 5-4 ps<1:0>: prescale select bits 00 = 1:1 01 = 1:16 10 = 1:64 11 = 1:256 bit 3-2 unimplemented: read as 0 bit 1-0 clksel<1:0>: clock select bits 00 = sosc 01 = lprc 10 = pwrlclk pin 11 = system clock downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 315 pic24fj1024ga610/gb610 family 22.3.2 rtcval register mappings register 22-4: rtccon2h: rtcc control register 2 (high) ( 1 ) r/w-0 r/w-0 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 div<15:8> bit 15 bit 8 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 div<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 div<15:0>: clock divide bits sets the period of the clock divider counter; value should cause a nominal 1/2 second underflow. note 1: a write to this register is only allowed when wrlock = 1 . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 316 ? 2015 microchip technology inc. register 22-5: rtccon3l: rtcc control register 3 (low) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pwcsamp7 pwcsamp6 pwcsamp5 pwcsamp4 pwcsamp3 pwcsamp2 pwcsamp1 pwcsamp0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 pwcstab7 pwcstab6 pwcstab5 pwcstab4 pwcstab3 pwcstab2 pwcstab1 pwcstab0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-8 pwcsamp<7:0>: power control sample window timer bits 11111111 = sample window is always enabled, even when pwcen = 0 11111110 = sample window is 254 t pwcclk clock periods 00000001 = sample window is 1 t pwcclk clock period 00000000 = no sample window bit 7-0 pwcstab<7:0>: power control stability window timer bits ( 1 ) 11111111 = stability window is 255 t pwcclk clock periods 11111110 = stability window is 254 t pwcclk clock periods 00000001 = stability window is 1 t pwcclk clock period 00000000 = no stability window; sample window starts when the alarm event triggers note 1: the sample window always starts when the stability window timer expires, except when its initial value is 00h. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 317 pic24fj1024ga610/gb610 family register 22-6: rtcstatl: rtcc status register (low) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 r/c-0 u-0 r/c-0 r-0 r-0 r-0 almevt tsaevt ( 1 ) sync almsync halfsec ( 2 ) bit 7 bit 0 legend: c = clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-6 unimplemented: read as 0 bit 5 almevt: alarm event bit 1 = an alarm event has occurred 0 = an alarm event has not occurred bit 4 unimplemented: read as 0 bit 3 tsaevt : timestamp a event bit ( 1 ) 1 = a timestamp event has occurred 0 = a timestamp event has not occurred bit 2 sync: synchronization status bit 1 = time registers may change during software read 0 = time registers may be read safely bit 1 almsync: alarm synchronization status bit 1 = alarm registers (almtime and almdate) and alarm mask bits (amask<3:0>) should not be modified, and alarm control bits (alrmen, almrpt<7:0>) may change during software read 0 = alarm registers and alarm control bits may be written/modified safely bit 0 halfsec: half second status bit ( 2 ) 1 = second half period of a second 0 = first half period of a second note 1: user software may write a 1 to this location to initiate a timestamp a event; timestamp capture is not valid until tsaevt reads as 1 . 2: this bit is read-only; it is cleared to 0 on a write to the secone<3:0> bits. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 318 ? 2015 microchip technology inc. 22.3.3 rtcc value registers register 22-7: timel: rtcc time register (low) u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x secten2 secten1 secten0 secone3 secone2 secone1 secone0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-12 secten<2:0>: binary coded decimal value of seconds 10 digit bits contains a value from 0 to 5. bit 11-8 secone<3:0>: binary coded decimal value of seconds 1 digit bits contains a value from 0 to 9. bit 7-0 unimplemented: read as 0 register 22-8: timeh: rtcc time register (high) u-0 u-0 r/w-0 r/w-x r/w-x r/w-x r/w-x r/w-x hrten1 hrten0 hrone3 hrone2 hrone1 hrone0 bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-x r/w-x r/w-x r/w-x r/w-x minten2 minten1 minten0 minone3 minone2 minone1 minone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-12 hrten<1:0>: binary coded decimal value of hours 10 digit bits contains a value from 0 to 2. bit 11-8 hrone<3:0>: binary coded decimal value of hours 1 digit bits contains a value from 0 to 9. bit 7 unimplemented: read as 0 bit 6-4 minten<2:0>: binary coded decimal value of minutes 10 digit bits contains a value from 0 to 5. bit 3-0 minone<3:0>: binary coded decimal value of minutes 1 digit bits contains a value from 0 to 9. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 319 pic24fj1024ga610/gb610 family register 22-9: datel: rtcc date register (low) u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 dayten1 dayten0 dayone3 dayone2 dayone1 dayone0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r/w-x r/w-x r/w-x wday2 wday1 wday0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-12 dayten<1:0>: binary coded decimal value of days 10 digit bits contains a value from 0 to 3. bit 11-8 dayone<3:0>: binary coded decimal value of days 1 digit bits contains a value from 0 to 9. bit 7-3 unimplemented: read as 0 bit 2-0 wday<2:0>: binary coded decimal value of weekdays 1 digit bits contains a value from 0 to 6. register 22-10: dateh: rtcc date register (high) r/w-0 r/w-0 r/w-0 r/w-0 r/w-x r/w-x r/w-x r/w-x yrten3 yrten2 yrten1 yrten0 yrone3 yrone2 yrone1 yrone0 bit 15 bit 8 u-0 u-0 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x mthten mthone3 mthone2 mthone1 mthone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-12 yrten<3:0>: binary coded decimal value of years 10 digit bits bit 11-8 yrone<3:0>: binary coded decimal value of years 1 digit bits bit 7-5 unimplemented: read as 0 bit 4 mthten: binary coded decimal value of months 10 digit bit contains a value from 0 to 1. bit 3-0 mthone<3:0>: binary coded decimal value of months 1 digit bits contains a value from 0 to 9. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 320 ? 2015 microchip technology inc. 22.3.4 alarm value registers register 22-11: almtimel: rtcc alarm time register (low) u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 secten2 secten1 secten0 secone3 secone2 secone1 secone0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-12 secten<2:0>: binary coded decimal value of seconds 10 digit bits contains a value from 0 to 5. bit 11-8 secone<3:0>: binary coded decimal value of seconds 1 digit bits contains a value from 0 to 9. bit 7-0 unimplemented: read as 0 register 22-12: almtimeh: rtcc alarm time register (high) u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 hrten1 hrten0 hrone3 hrone2 hrone1 hrone0 bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 minten2 minten1 minten0 minone3 minone2 minone1 minone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-12 hrten<1:0>: binary coded decimal value of hours 10 digit bits contains a value from 0 to 2. bit 11-8 hrone<3:0>: binary coded decimal value of hours 1 digit bits contains a value from 0 to 9. bit 7 unimplemented: read as 0 bit 6-4 minten<2:0>: binary coded decimal value of minutes 10 digit bits contains a value from 0 to 5. bit 3-0 minone<3:0>: binary coded decimal value of minutes 1 digit bits contains a value from 0 to 9. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 321 pic24fj1024ga610/gb610 family register 22-13: almdatel: rtcc alarm date register (low) u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 dayten1 dayten0 dayone3 dayone2 dayone1 dayone0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 wday2 wday1 wday0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-12 dayten<1:0>: binary coded decimal value of days 10 digit bits contains a value from 0 to 3. bit 11-8 dayone<3:0>: binary coded decimal value of days 1 digit bits contains a value from 0 to 9. bit 7-3 unimplemented: read as 0 bit 2-0 wday<2:0>: binary coded decimal value of weekdays 1 digit bits contains a value from 0 to 6. register 22-14: almdateh: rtcc alarm date register (high) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 yrten3 yrten2 yrten1 yrten0 yrone3 yrone2 yrone1 yrone0 bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 mthten mthone3 mthone2 mthone1 mthone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-12 yrten<3:0>: binary coded decimal value of years 10 digit bits bit 11-8 yrone<3:0>: binary coded decimal value of years 1 digit bits bit 7-5 unimplemented: read as 0 bit 4 mthten: binary coded decimal value of months 10 digit bit contains a value from 0 to 1. bit 3-0 mthone<3:0>: binary coded decimal value of months 1 digit bits contains a value from 0 to 9. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 322 ? 2015 microchip technology inc. 22.3.5 timestamp registers register 22-15: tsatimel: rtcc timestamp a time register (low) ( 1 ) u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 secten2 secten1 secten0 secone3 secone2 secone1 secone0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-12 secten<2:0>: binary coded decimal value of seconds 10 digit bits contains a value from 0 to 5. bit 11-8 secone<3:0>: binary coded decimal value of seconds 1 digit bits contains a value from 0 to 9. bit 7-0 unimplemented: read as 0 note 1: if tsaen = 0 , bits<15:0> can be used for persistent storage throughout a non-power-on reset (mclr , wdt, etc.). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 323 pic24fj1024ga610/gb610 family register 22-16: tsatimeh: rtcc timestamp a time register (high) ( 1 ) u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 hrten1 hrten0 hrone3 hrone2 hrone1 hrone0 bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 minten2 minten1 minten0 minone3 minone2 minone1 minone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-12 hrten<1:0>: binary coded decimal value of hours 10 digit bits contains a value from 0 to 2. bit 11-8 hrone<3:0>: binary coded decimal value of hours 1 digit bits contains a value from 0 to 9. bit 7 unimplemented: read as 0 bit 6-4 minten<2:0>: binary coded decimal value of minutes 10 digit bits contains a value from 0 to 5. bit 3-0 minone<3:0>: binary coded decimal value of minutes 1 digit bits contains a value from 0 to 9. note 1: if tsaen = 0 , bits<15:0> can be used for persistence storage throughout a non-power-on reset (mclr , wdt, etc.). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 324 ? 2015 microchip technology inc. register 22-17: tsadatel: rtcc timestamp a date register (low) ( 1 ) u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 dayten1 dayten0 dayone3 dayone2 dayone1 dayone0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 wday2 wday1 wday0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 unimplemented: read as 0 bit 13-12 dayten<1:0>: binary coded decimal value of days 10 digit bits contains a value from 0 to 3. bit 11-8 dayone<3:0>: binary coded decimal value of days 1 digit bits contains a value from 0 to 9. bit 7-3 unimplemented: read as 0 bit 2-0 wday<2:0>: binary coded decimal value of weekdays 1 digit bits contains a value from 0 to 6. note 1: if tsaen = 0 , bits<15:0> can be used for persistence storage throughout a non-power-on reset (mclr , wdt, etc.). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 325 pic24fj1024ga610/gb610 family register 22-18: tsadateh: rtcc timestamp a date register (high) ( 1 ) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 yrten3 yrten2 yrten1 yrten0 yrone3 yrone2 yrone1 yrone0 bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 mthten mthone3 mthone2 mthone1 mthone0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-12 yrten<3:0>: binary coded decimal value of years 10 digit bits bit 11-8 yrone<3:0>: binary coded decimal value of years 1 digit bits bit 7-5 unimplemented: read as 0 bit 4 mthten: binary coded decimal value of months 10 digit bit contains a value from 0 to 1. bit 3-0 mthone<2:0>: binary coded decimal value of months 1 digit bits contains a value from 0 to 9. note 1: if tsaen = 0 , bits<15:0> can be used for persistence storage throughout a non-power-on reset (mclr , wdt, etc.). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 326 ? 2015 microchip technology inc. 22.4 calibration 22.4.1 clock source calibration a crystal oscillator that is connected to the rtcc may be calibrated to provide an accurate 1 second clock in two ways. first, coarse frequency adjustment is per- formed by adjusting the value written to the div<15:0> bits. secondly, a 5-bit value can be written to the fdiv<4:0> control bits to perform a fine clock division. the divx and fdivx values can be concatenated and considered as a 21-bit prescaler value. if the oscillator source is slightly faster than ideal, the fdiv<4:0> value can be increased to make a small decrease in the rtc frequency. the value of div<15:0> should be increased to make larger decreases in the rtc frequency. if the oscillator source is slower than ideal, fdiv<4:0> may be decreased for small calibration changes and div<15:0> may need to be decreased to make larger calibration changes. before calibration, the user must determine the error of the crystal. this should be done using another timer resource on the device or an external timing reference. it is up to the user to include in the error value, the initial error of the crystal, drift due to temperature and drift due to crystal aging. 22.5 alarm configurable from half second to one year enabled using the alrmen bit (rtccon1h<15>) one-time alarm and repeat alarm options are available 22.5.1 configuring the alarm the alarm feature is enabled using the alrmen bit. this bit is cleared when an alarm is issued. writes to alrmval should only take place when alrmen = 0 . as shown in figure 22-2 , the interval selection of the alarm is configured through the amask<3:0> bits (rtccon1h<11:8>). these bits determine which and how many digits of the alarm must match the clock value for the alarm to occur. the alarm can also be configured to repeat based on a preconfigured interval. the amount of times this occurs, once the alarm is enabled, is stored in the almrpt<7:0> bits (rtccon1h<7:0>). when the value of the almrptx bits equals 00h and the chime bit (rtccon1h<14>) is cleared, the repeat function is disabled and only a single alarm will occur. the alarm can be repeated, up to 255 times by loading almrpt<7:0> with ffh. after each alarm is issued, the value of the almrptx bits is decremented by one. once the value has reached 00h, the alarm will be issued one last time, after which, the alrmen bit will be cleared automatically and the alarm will turn off. indefinite repetition of the alarm can occur if the chime bit = 1 . instead of the alarm being disabled when the value of the almrptx bits reaches 00h, it rolls over to ffh and continues counting indefinitely while chime is set. 22.5.2 alarm interrupt at every alarm event, an interrupt is generated. this output is completely synchronous to the rtcc clock and can be used as a trigger clock to the other peripherals. note: changing any of the register bits, other than the rtcoe bit (rtccon1l<7>), the almrpt<7:0> bits (rtccon1h<7:0> and the chime bit, while the alarm is enabled (alrmen = 1 ), can result in a false alarm event leading to a false alarm interrupt. to avoid a false alarm event, the timer and alarm values should only be changed while the alarm is disabled (alrmen = 0 ). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 327 pic24fj1024ga610/gb610 family figure 22-2: alarm mask settings 22.6 power control the rtcc includes a power control feature that allows the device to periodically wake-up an external device, wait for the device to be stable before sampling wake-up events from that device and then shut down the external device. this can be done completely autonomously by the rtcc, without the need to wake-up from the current lower power mode. to use this feature: 1. enable the rtcc (rtcen = 1 ). 2. set the pwcen bit (rtccon1l<10>). 3. configure the rtcc pin to drive the pwc control signal (rtcoe = 1 and outsel<2:0> = 011 ). the polarity of the pwc control signal may be chosen using the pwcpol bit (rtccon1l<9>). an active- low or active-high signal may be used with the appropriate external switch to turn on or off the power to one or more external devices. the active-low setting may also be used in conjunction with an open-drain setting on the rtcc pin, in order to drive the ground pin(s) of the external device directly (with the appropri- ate external v dd pull-up device), without the need for external switches. finally, the chime bit should be set to enable the pwc periodicity. once the rtcc and pwc are enabled and running, the pwc logic will generate a control output and a sample gate output. the control output is driven out on the rtcc pin (when rtcoe = 1 and outsel<2:0> = 011 ) and is used to power up or down the device, as described above. once the control output is asserted, the stability win- dow begins, in which the external device is given enough time to power up and provide a stable output. once the output is stable, the rtcc provides a sample gate during the sample window. the use of this sample gate depends on the external device being used, but typically, it is used to mask out one or more wake-up signals from the external device. finally, both the stability and the sample windows close after the expiration of the sample window and the external device is powered down. note 1: annually, except when configured for february 29. s ss mss mm s s hh mm ss dh h m m s s dd hh mm s s mm d d h h mm s s day of the week month day hours minutes seconds alarm mask setting (amask<3:0>) 0000 - every half second 0001 - every second 0010 - every 10 seconds 0011 - every minute 0100 - every 10 minutes 0101 - every hour 0110 - every day 0111 - every week 1000 - every month 1001 - every year (1) downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 328 ? 2015 microchip technology inc. 22.6.1 power control clock source the stability and sample windows are controlled by the pwcsampx and pwcstabx bit fields in the rtccon3l register (rtccon3l<15:8> and <7:0>, respectively). as both the stability and sample windows are defined in terms of the rtcc clock, their absolute values vary by the value of the pwc clock base period (t pwcclk ). for example, using a 32.768 khz sosc input clock would produce a t pwcclk of 1/32768 = 30.518 s. the 8-bit magnitude of pwcstabx and pwcsampx allows for a window size of 0 to 255 t pwcclk . the period of the pwc clock can also be adjusted with a 1:1, 1:16, 1:64 or 1:256 prescaler, determined by the pwcps<1:0> bits (rtccon2l<7:6>). in addition, certain values for the pwcstabx and pwcsampx fields have specific control meanings in determining power control operations. if either bit field is 00h, the corresponding window is inactive. in addition, if the pwcstabx field is ffh, the stability window remains active continuously, even if power control is disabled. 22.7 event timestamping the rtcc includes a set of timestamp registers that may be used for the capture of time and date register values when an external input signal is received. the rtcc will trigger a timestamp event when a low pulse occurs on the tmpr pin. 22.7.1 timestamp operation the event input is enabled for timestamping using the tsaen bit (rtccon1l<0>). when the timestamp event occurs, the present time and date values will be stored in the tsatimel/h and tsadatel/h registers, the tsaevt status bit (rtcstatl<3>) will be set and an rtcc interrupt will occur. a new timestamp capture event cannot occur until the user clears the tsaevt status bit. 22.7.2 manual timestamp operation the current time and date may be captured in the tsatimel/h and tsadatel/h registers by writing a 1 to the tsaevt bit location while the timestamp func- tionality is enabled (tsaen = 1 ). this write will not set the tsaevt bit, but it will initiate a timestamp capture. the tsaevt bit will be set when the capture operation is complete. the user must poll the tsaevt bit to determine when the capture operation is complete. after the timestamp registers have been read, the tsaevt bit should be cleared to allow further hardware or software timestamp capture events. note 1: the tsatimel/h and tsadatel/h regis- ter pairs can be used for data storage when tsaen = 0 . the values of tsatimel/h and tsadatel/h will be maintained throughout all types of non-power-on resets (mclr , wdt, etc). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 329 pic24fj1024ga610/gb610 family 23.0 32-bit programmable cyclic redundancy check (crc) generator the 32-bit programmable crc generator provides a hardware implemented method of quickly generating checksums for various networking and security applications. it offers the following features: user-programmable crc polynomial equation, up to 32 bits programmable shift direction (little or big-endian) independent data and polynomial lengths configurable interrupt output data fifo figure 23-1 displays a simplified block diagram of the crc generator. a simple version of the crc shift engine is displayed in figure 23-2 . figure 23-1: crc block diagram figure 23-2: crc shift engine detail note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference manual , 32-bit programmable cyclic redundancy check (crc) (ds30009729), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. crc interrupt variable fifo (4x32, 8x16 or 16x8) crcdath crcdatl shift buffer crc shift engine crcwdath crcwdatl shifter clock 2 * f cy lendian crcisel 1 0 fifo empty event shift complete event 1 0 note 1: n = plen<4:0> + 1. crc shift engine crcwdath crcwdatl bit 1 x0 x1 xn (1) read/write bus shift buffer data bit 0 bit n (1) downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 330 ? 2015 microchip technology inc. 23.1 user interface 23.1.1 polynomial interface the crc module can be programmed for crc polynomials of up to the 32 nd order, using up to 32 bits. polynomial length, which reflects the highest exponent in the equation, is selected by the plen<4:0> bits (crccon2<4:0>). the crcxorl and crcxorh registers control which exponent terms are included in the equation. setting a particular bit includes that exponent term in the equa- tion. functionally, this includes an xor operation on the corresponding bit in the crc engine. clearing the bit disables the xor. for example, consider two crc polynomials, one a 16-bit and the other a 32-bit equation. equation 23-1: 16-bit, 32-bit crc polynomials to program these polynomials into the crc generator, set the register bits, as shown in table 23-1 . note that the appropriate positions are set to 1 to indi- cate that they are used in the equation (for example, x26 and x23). the 0 bit required by the equation is always xored; thus, x0 is a dont care. for a poly- nomial of length 32, it is assumed that the 32 nd bit will be used. therefore, the x<31:1> bits do not have the 32 nd bit. 23.1.2 data interface the module incorporates a fifo that works with a variable data width. input data width can be configured to any value between 1 and 32 bits using the dwidth<4:0> bits (crccon2<12:8>). when the data width is greater than 15, the fifo is 4 words deep. when the dwidthx bits are between 15 and 8, the fifo is 8 words deep. when the dwidthx bits are less than 8, the fifo is 16 words deep. the data for which the crc is to be calculated must first be written into the fifo. even if the data width is less than 8, the smallest data element that can be written into the fifo is 1 byte. for example, if the dwidthx bits are 5, then the size of the data is dwidth<4:0> + 1 or 6. the data is written as a whole byte; the two unused upper bits are ignored by the module. once data is written into the msb of the crcdat registers (that is, the msb as defined by the data width), the value of the vword<4:0> bits (crccon1<12:8>) increments by one. for example, if the dwidthx bits are 24, the vwordx bits will increment when bit 7 of crcdath is written. therefore, crcdatl must always be written to before crcdath. the crc engine starts shifting data when the crcgo bit (crccon1<4>) is set and the value of the vwordx bits is greater than zero. each word is copied out of the fifo into a buffer register, which decrements the vwordx bits. the data is then shifted out of the buffer. the crc engine continues shifting at a rate of two bits per instruction cycle, until the vwordx bits reach zero. this means that for a given data width, it takes half that number of instructions for each word to complete the calculation. for example, it takes 16 cycles to calculate the crc for a single word of 32-bit data. when the vwordx bits reach the maximum value for the configured value of the dwidthx bits (4, 8 or 16), the crcful bit (crccon1<7>) becomes set. when the vwordx bits reach zero, the crcmpt bit (crccon1<6>) becomes set. the fifo is emptied and the vword<4:0> bits are set to 00000 whenever crcen is 0 . at least one instruction cycle must pass after a write to crcwdat before a read of the vwordx bits is done. and x32+x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 x16 + x12 + x5 + 1 table 23-1: crc setup examples for 16 and 32-bit polynomials crc control bits bit values 16-bit polynomial 32-bit polynomial plen<4:0> 01111 11111 x<31:16> 0000 0000 0000 0001 0000 0100 1100 0001 x<15:1> 0001 0000 0010 000 0001 1101 1011 011 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 331 pic24fj1024ga610/gb610 family 23.1.3 data shift direction the lendian bit (crccon1<3>) is used to control the shift direction. by default, the crc will shift data through the engine, msb first. setting lendian (= 1 ) causes the crc to shift data, lsb first. this setting allows better integration with various communication schemes and removes the overhead of reversing the bit order in software. note that this only changes the direction the data is shifted into the engine. the result of the crc calculation will still be a normal crc result, not a reverse crc result. 23.1.4 interrupt operation the module generates an interrupt that is configurable by the user for either of two conditions. if crcisel is 0 , an interrupt is generated when the vword<4:0> bits make a transition from a value of 1 to 0 . if crcisel is 1 , an interrupt will be generated after the crc operation finishes and the module sets the crcgo bit to 0 . manually setting crcgo to 0 will not generate an interrupt. note that when an interrupt occurs, the crc calculation would not yet be complete. the module will still need (plenx + 1)/2 clock cycles after the interrupt is generated until the crc calculation is finished. 23.1.5 typical operation to use the module for a typical crc calculation: 1. set the crcen bit to enable the module. 2. configure the module for desired operation: a) program the desired polynomial using the crcxor registers and plen<4:0> bits. b) configure the data width and shift direction using the dwidth<4:0> and lendian bits. 3. set the crcgo bit to start the calculations. 4. set the desired crc non-direct initial value by writing to the crcwdat registers. 5. load all data into the fifo by writing to the crcdat registers as space becomes available (the crcful bit must be zero before the next data loading). 6. wait until the data fifo is empty (crcmpt bit is set). 7. read the result: if the data width (dwidth<4:0> bits) is more than the polynomial length (plen<4:0> bits): a) wait (dwidth<4:0> + 1)/2 instruction cycles to make sure that shifts from the shift buffer are finished. b) change the data width to the polynomial length (dwidth<4:0> = plen<4:0>). c) write one dummy data word to the crcdat registers. d) wait 2 instruction cycles to move the data from the fifo to the shift buffer and (plen<4:0> + 1)/2 instruction cycles to shift out the result. or, if the data width (dwidth<4:0> bits) is less than the polynomial length (plen<4:0> bits): 1. clear the crc interrupt selection bit (crcisel = 0 ) to get the interrupt when all shifts are done. clear the crc interrupt flag. write dummy data in the crcdat registers and wait until the crc interrupt flag is set. 2. read the final crc result from the crcwdat registers. 3. restore the data width (dwidth<4:0> bits) for further calculations (optional). if the data width (dwidth<4:0> bits) is equal to, or less than, the polynomial length (plen<4:0> bits): a) clear the crc interrupt selection bit (crcisel = 0 ) to get the interrupt when all shifts are done. b) suspend the calculation by setting crcgo = 0 . c) clear the crc interrupt flag. d) write the dummy data with the total data length equal to the polynomial length in the crcdat registers. e) resume the calculation by setting crcgo = 1 . f) wait until the crc interrupt flag is set. g) read the final crc result from the crcwdat registers. there are eight registers used to control programmable crc operation: crccon1 crccon2 crcxorl crcxorh crcdatl crcdath crcwdatl crcwdath the crccon1 and crccon2 registers ( register 23-1 and register 23-2 ) control the operation of the module and configure the various settings. the crcxor registers ( register 23-3 and register 23-4 ) select the polynomial terms to be used in the crc equation. the crcdat and crcwdat registers are each register pairs that serve as buffers for the double-word input data, and crc processed output, respectively. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 332 ? 2015 microchip technology inc. register 23-1: crccon1: crc control 1 register r/w-0 u-0 r/w-0 r-0, hsc r-0, hsc r-0, hsc r-0, hsc r-0, hsc crcen csidl vword4 vword3 vword2 vword1 vword0 bit 15 bit 8 r-0, hsc r-1, hsc r/w-0 r/w-0, hc r/w-0 u-0 u-0 u-0 crcful crcmpt crcisel crcgo lendian bit 7 bit 0 legend: hc = hardware clearable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 crcen: crc enable bit 1 = enables module 0 = disables module; all state machines, pointers and crcwdat/crcdath reg isters reset; other sfrs are not reset bit 14 unimplemented: read as 0 bit 13 csidl: crc stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12-8 vword<4:0>: crc pointer value bits indicates the number of valid words in the fifo. has a maximum value of 8 when plen<4:0> ? 7 or 16 when plen<4:0> ?? 7. bit 7 crcful: crc fifo full bit 1 = fifo is full 0 = fifo is not full bit 6 crcmpt: crc fifo empty bit 1 = fifo is empty 0 = fifo is not empty bit 5 crcisel: crc interrupt selection bit 1 = interrupt on fifo is empty; the final word of data is still shifting through the crc 0 = interrupt on shift is complete and results are ready bit 4 crcgo: start crc bit 1 = starts crc serial shifter 0 = crc serial shifter is turned off bit 3 lendian: data shift direction select bit 1 = data word is shifted into the crc, starting with the lsb (little-endian) 0 = data word is shifted into the crc, starting with the msb (big-endian) bit 2-0 unimplemented: read as 0 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 333 pic24fj1024ga610/gb610 family register 23-2: crccon2: crc control 2 register u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 dwidth4 dwidth3 dwidth2 dwidth1 dwidth0 bit 15 bit 8 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 plen4 plen3 plen2 plen1 plen0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-13 unimplemented: read as 0 bit 12-8 dwidth<4:0>: crc data word width configuration bits configures the width of the data word (data word width C 1). bit 7-5 unimplemented: read as 0 bit 4-0 plen<4:0>: polynomial length configuration bits configures the length of the polynomial (polynomial length C 1). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 334 ? 2015 microchip technology inc. register 23-3: crcxorl: crc xor polynomial register, low byte r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 x<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 x<7:1> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-1 x<15:1>: xor of polynomial term x n enable bits bit 0 unimplemented: read as 0 register 23-4: crcxorh: crc xor polynomial register, high byte r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 x<31:24> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 x<23:16> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 x<31:16>: xor of polynomial term x n enable bits downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 335 pic24fj1024ga610/gb610 family 24.0 configurable logic cell (clc) the configurable logic cell (clc) module allows the user to specify combinations of signals as inputs to a logic function and to use the logic output to control other peripherals or i/o pins. this provides greater flexibility and potential in embedded designs, since the clc module can operate outside the limitations of software execution and supports a vast amount of output designs. there are four input gates to the selected logic func- tion. these four input gates select from a pool of up to 32 signals that are selected using four data source selection multiplexers. figure 24-1 shows an overview of the module. figure 24-3 shows the details of the data source multiplexers and logic input gate connections. figure 24-1: clcx module gate 1 gate 2 gate 3 gate 4 logic function input data selection gates clcx lcoe logic lcpol mode<2:0> clcx clcin[0] clcin[1] clcin[2] clcin[3] clcin[4] clcin[5] clcin[6] clcin[7] clcin[8] clcin[9] clcin[10] clcin[11] clcin[12] clcin[13] clcin[14] clcin[15] trisx control interrupt det intp intn lcen clcxif sets flag note: all register bits shown in this figure can be found in the clcxconl register. output output clcin[16] clcin[17] clcin[18] clcin[19] clcin[20] clcin[21] clcin[22] clcin[23] clcin[24] clcin[25] clcin[26] clcin[27] clcin[28] clcin[29] clcin[30] clcin[31] see figure 24-2 see figure 24-3 interrupt det downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 336 ? 2015 microchip technology inc. figure 24-2: clcx logic func tion combinatorial options gate 1 gate 2 gate 3 gate 4 logic output gate 1 gate 2 gate 3 gate 4 logic output gate 1 gate 2 gate 3 gate 4 logic output sr q gate 1 gate 2 gate 3 gate 4 logic output dq gate 1 gate 2 gate 3 gate 4 logic output s r jq gate 2 gate 3 gate 4 logic output r gate 1 k dq gate 1 gate 2 gate 3 gate 4 logic output s r dq gate 1 gate 3 logic output r gate 4 gate 2 mode<2:0> = 000 mode<2:0> = 010 mode<2:0> = 001 mode<2:0> = 011 mode<2:0> = 100 mode<2:0> = 110 mode<2:0> = 101 mode<2:0> = 111 le and C or or C xor 4-input and s-r latch 1-input d flip-flop with s and r 2-input d flip-flop with r 1-input transparent latch with s and r j-k flip-flop with r downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 337 pic24fj1024ga610/gb610 family figure 24-3: clcx input source selection diagram gate 1 g1pol data gate 1 g1d1t gate 2 gate 3 gate 4 data gate 2 data gate 3 data gate 4 g1d1n ds1x (clcxsel<2:0>) ds2x (clcxsel<6:4>) clcin[0] clcin[1] clcin[2] clcin[5] clcin[6] clcin[7] data selection note: all controls are undefined at power-up. data 1 non-inverted data 1 data 2 non-inverted data 2 data 3 non-inverted data 3 data 4 non-inverted data 4 (same as data gate 1) (same as data gate 1) (same as data gate 1) g1d2t g1d2n g1d3t g1d3n g1d4t g1d4n inverted inverted inverted inverted clcin[8] clcin[9] clcin[10] clcin[13] clcin[14] clcin[15] clcin[3] clcin[4] clcin[11] clcin[12] clcin[18] clcin[21] clcin[22] clcin[23] clcin[19] clcin[20] clcin[17] clcin[16] ds3x (clcxsel<10:8>) clcin[26] clcin[29] clcin[30] clcin[31] clcin[27] clcin[28] clcin[25] clcin[24] ds4x (clcxsel<14:12>) 000111 000111 000111 000111 (clcxconh<0>) downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 338 ? 2015 microchip technology inc. 24.1 control registers the clcx module is controlled by the following registers: clcxconl clcxconh clcxsel clcxglsl clcxglsh the clcx control registers (clcxconl and clcxconh) are used to enable the module and inter- rupts, control the output enable bit, select output polarity and select the logic function. the clcx control registers also allow the user to control the logic polarity of not only the cell output, but also some intermediate variables. the clcx input mux select register (clcxsel) allows the user to select up to 4 data input sources using the 4 data input selection multiplexers. each multiplexer has a list of 8 data sources available. the clcx gate logic input select registers (clcxglsl and clcxglsh) allow the user to select which outputs from each of the selection muxes are used as inputs to the input gates of the logic cell. each data source mux outputs both a true and a negated version of its output. all of these 8 signals are enabled, ored together by the logic cell input gates. register 24-1: clcxconl: clcx control register (low) r/w-0 u-0 u-0 u-0 r/w-0 r/w-0 u-0 u-0 lcen intp intn bit 15 bit 8 r/w-0 r-0 r/w-0 u-0 u-0 r/w-0 r/w-0 r/w-0 lcoe lcout lcpol mode2 mode1 mode0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 lcen: clcx enable bit 1 = clcx is enabled and mixing input signals 0 = clcx is disabled and has logic zero outputs bit 14-12 unimplemented: read as 0 bit 11 intp: clcx positive edge interrupt enable bit 1 = interrupt will be generated when a rising edge occurs on lcout 0 = interrupt will not be generated bit 10 intn: clcx negative edge interrupt enable bit 1 = interrupt will be generated when a falling edge occurs on lcout 0 = interrupt will not be generated bit 9-8 unimplemented: read as 0 bit 7 lcoe: clcx port enable bit 1 = clcx port pin output is enabled 0 = clcx port pin output is disabled bit 6 lcout: clcx data output status bit 1 = clcx output high 0 = clcx output low bit 5 lcpol: clcx output polarity control bit 1 = the output of the module is inverted 0 = the output of the module is not inverted bit 4-3 unimplemented: read as 0 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 339 pic24fj1024ga610/gb610 family bit 2-0 mode<2:0>: clcx mode bits 111 = cell is a 1-input transparent latch with s and r 110 = cell is a jk flip-flop with r 101 = cell is a 2-input d flip-flop with r 100 = cell is a 1-input d flip-flop with s and r 011 = cell is an sr latch 010 = cell is a 4-input and 001 = cell is an or-xor 000 = cell is a and-or register 24-1: clcxconl: clcx cont rol register (low) (continued) register 24-2: clcxconh: clcx control register (high) u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 g4pol g3pol g2pol g1pol bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-4 unimplemented: read as 0 bit 3 g4pol: gate 4 polarity control bit 1 = the output of channel 4 logic is inverted when applied to the logic cell 0 = the output of channel 4 logic is not inverted bit 2 g3pol: gate 3 polarity control bit 1 = the output of channel 3 logic is inverted when applied to the logic cell 0 = the output of channel 3 logic is not inverted bit 1 g2pol: gate 2 polarity control bit 1 = the output of channel 2 logic is inverted when applied to the logic cell 0 = the output of channel 2 logic is not inverted bit 0 g1pol: gate 1 polarity control bit 1 = the output of channel 1 logic is inverted when applied to the logic cell 0 = the output of channel 1 logic is not inverted downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 340 ? 2015 microchip technology inc. register 24-3: clcxsel: clcx input mux select register u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 d s 4 < 2 : 0 > d s 3 < 2 : 0 > bit 15 bit 8 u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 d s 2 < 2 : 0 > d s 1 < 2 : 0 > bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-12 ds4<2:0>: data selection mux 4 signal selection bits 111 = mccp3 compare event interrupt flag (ccp3if) 110 = mccp1 compare event interrupt flag (ccp1if) 101 = unimplemented 100 = ctmu a/d trigger 011 = spix input (sdix) corresponding to the clcx module (see table 24-1 ) 010 = comparator 3 output 001 = module-specific clcx output (see tab l e 2 4- 1 ) 000 = clcinb i/o pin bit 11 unimplemented: read as 0 bit 10-8 ds3<2:0>: data selection mux 3 signal selection bits 111 = mccp3 compare event interrupt flag (ccp3if) 110 = mccp2 compare event interrupt flag (ccp2if) 101 = dma channel 1 interrupt 100 = uartx rx output corresponding to the clcx module (see ta b l e 2 4 - 1 ) 011 = spix output (sdox) corresponding to the clcx module (see tab l e 2 4- 1 ) 010 = comparator 2 output 001 = clcx output (see tab le 2 4- 1 ) 000 = clcina i/o pin bit 7 unimplemented: read as 0 bit 6-4 ds2<2:0>: data selection mux 2 signal selection bits 111 = mccp2 compare event interrupt flag (ccp2if) 110 = mccp1 compare event interrupt flag (ccp1if) 101 = dma channel 0 interrupt 100 = a/d conversion done interrupt 011 = uartx tx input corresponding to the clcx module (see table 24-1 ) 010 = comparator 1 output 001 = clcx output (see tab le 2 4- 1 ) 000 = clcinb i/o pin bit 3 unimplemented: read as 0 bit 2-0 ds1<2:0>: data selection mux 1 signal selection bits 111 = timer3 match event 110 = timer2 match event 101 = unimplemented 100 = refo output 011 = intrc/lprc clock source 010 = sosc clock source 001 = system clock (t cy ) 000 = clcina i/o pin downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 341 pic24fj1024ga610/gb610 family table 24-1: module-specific input data sources bit field value input source clc1 clc2 clc3 clc4 ds4<2:0> 011 sdi1 sdi2 sdi3 unimplemented 001 clc2 output clc1 output clc4 output clc3 output ds3<2:0> 100 u1rx u2rx u3rx u4rx 011 sdo1 sdo2 sdo3 unimplemented 001 clc1 output clc2 output clc3 output clc4 output ds2<2:0> 011 u1tx u2tx u3tx u4tx 001 clc2 output clc1 output clc4 output clc3 output register 24-4: clcxglsl: clcx gate logic input select low register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 g2d4t g2d4n g2d3t g2d3n g2d2t g2d2n g2d1t g2d1n bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 g1d4t g1d4n g1d3t g1d3n g1d2t g1d2n g1d1t g1d1n bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 g2d4t: gate 2 data source 4 true enable bit 1 = the data source 4 signal is enabled for gate 2 0 = the data source 4 signal is disabled for gate 2 bit 14 g2d4n: gate 2 data source 4 negated enable bit 1 = the data source 4 inverted signal is enabled for gate 2 0 = the data source 4 inverted signal is disabled for gate 2 bit 13 g2d3t: gate 2 data source 3 true enable bit 1 = the data source 3 signal is enabled for gate 2 0 = the data source 3 signal is disabled for gate 2 bit 12 g2d3n: gate 2 data source 3 negated enable bit 1 = the data source 3 inverted signal is enabled for gate 2 0 = the data source 3 inverted signal is disabled for gate 2 bit 11 g2d2t: gate 2 data source 2 true enable bit 1 = the data source 2 signal is enabled for gate 2 0 = the data source 2 signal is disabled for gate 2 bit 10 g2d2n: gate 2 data source 2 negated enable bit 1 = the data source 2 inverted signal is enabled for gate 2 0 = the data source 2 inverted signal is disabled for gate 2 bit 9 g2d1t: gate 2 data source 1 true enable bit 1 = the data source 1 signal is enabled for gate 2 0 = the data source 1 signal is disabled for gate 2 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 342 ? 2015 microchip technology inc. bit 8 g2d1n: gate 2 data source 1 negated enable bit 1 = the data source 1 inverted signal is enabled for gate 2 0 = the data source 1 inverted signal is disabled for gate 2 bit 7 g1d4t: gate 1 data source 4 true enable bit 1 = the data source 4 signal is enabled for gate 1 0 = the data source 4 signal is disabled for gate 1 bit 6 g1d4n: gate 1 data source 4 negated enable bit 1 = the data source 4 inverted signal is enabled for gate 1 0 = the data source 4 inverted signal is disabled for gate 1 bit 5 g1d3t: gate 1 data source 3 true enable bit 1 = the data source 3 signal is enabled for gate 1 0 = the data source 3 signal is disabled for gate 1 bit 4 g1d3n: gate 1 data source 3 negated enable bit 1 = the data source 3 inverted signal is enabled for gate 1 0 = the data source 3 inverted signal is disabled for gate 1 bit 3 g1d2t: gate 1 data source 2 true enable bit 1 = the data source 2 signal is enabled for gate 1 0 = the data source 2 signal is disabled for gate 1 bit 2 g1d2n: gate 1 data source 2 negated enable bit 1 = the data source 2 inverted signal is enabled for gate 1 0 = the data source 2 inverted signal is disabled for gate 1 bit 1 g1d1t: gate 1 data source 1 true enable bit 1 = the data source 1 signal is enabled for gate 1 0 = the data source 1 signal is disabled for gate 1 bit 0 g1d1n: gate 1 data source 1 negated enable bit 1 = the data source 1 inverted signal is enabled for gate 1 0 = the data source 1 inverted signal is disabled for gate 1 register 24-4: clcxglsl: clcx gate logic input select low register (continued) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 343 pic24fj1024ga610/gb610 family register 24-5: clcxglsh: clcx gate logic input select high register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 g4d4t g4d4n g4d3t g4d3n g4d2t g4d2n g4d1t g4d1n bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 g3d4t g3d4n g3d3t g3d3n g3d2t g3d2n g3d1t g3d1n bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 g4d4t: gate 4 data source 4 true enable bit 1 = the data source 4 signal is enabled for gate 4 0 = the data source 4 signal is disabled for gate 4 bit 14 g4d4n: gate 4 data source 4 negated enable bit 1 = the data source 4 inverted signal is enabled for gate 4 0 = the data source 4 inverted signal is disabled for gate 4 bit 13 g4d3t: gate 4 data source 3 true enable bit 1 = the data source 3 signal is enabled for gate 4 0 = the data source 3 signal is disabled for gate 4 bit 12 g4d3n: gate 4 data source 3 negated enable bit 1 = the data source 3 inverted signal is enabled for gate 4 0 = the data source 3 inverted signal is disabled for gate 4 bit 11 g4d2t: gate 4 data source 2 true enable bit 1 = the data source 2 signal is enabled for gate 4 0 = the data source 2 signal is disabled for gate 4 bit 10 g4d2n: gate 4 data source 2 negated enable bit 1 = the data source 2 inverted signal is enabled for gate 4 0 = the data source 2 inverted signal is disabled for gate 4 bit 9 g4d1t: gate 4 data source 1 true enable bit 1 = the data source 1 signal is enabled for gate 4 0 = the data source 1 signal is disabled for gate 4 bit 8 g4d1n: gate 4 data source 1 negated enable bit 1 = the data source 1 inverted signal is enabled for gate 4 0 = the data source 1 inverted signal is disabled for gate 4 bit 7 g3d4t: gate 3 data source 4 true enable bit 1 = the data source 4 signal is enabled for gate 3 0 = the data source 4 signal is disabled for gate 3 bit 6 g3d4n: gate 3 data source 4 negated enable bit 1 = the data source 4 inverted signal is enabled for gate 3 0 = the data source 4 inverted signal is disabled for gate 3 bit 5 g3d3t: gate 3 data source 3 true enable bit 1 = the data source 3 signal is enabled for gate 3 0 = the data source 3 signal is disabled for gate 3 bit 4 g3d3n: gate 3 data source 3 negated enable bit 1 = the data source 3 inverted signal is enabled for gate 3 0 = the data source 3 inverted signal is disabled for gate 3 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 344 ? 2015 microchip technology inc. bit 3 g3d2t: gate 3 data source 2 true enable bit 1 = the data source 2 signal is enabled for gate 3 0 = the data source 2 signal is disabled for gate 3 bit 2 g3d2n: gate 3 data source 2 negated enable bit 1 = the data source 2 inverted signal is enabled for gate 3 0 = the data source 2 inverted signal is disabled for gate 3 bit 1 g3d1t: gate 3 data source 1 true enable bit 1 = the data source 1 signal is enabled for gate 3 0 = the data source 1 signal is disabled for gate 3 bit 0 g3d1n: gate 3 data source 1 negated enable bit 1 = the data source 1 inverted signal is enabled for gate 3 0 = the data source 1 inverted signal is disabled for gate 3 register 24-5: clcxglsh: clcx gate logic input select high register (continued) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 345 pic24fj1024ga610/gb610 family 25.0 12-bit a/d converter with threshold detect the a/d converter has the following key features: successive approximation register (sar) conversion selectable 10-bit or 12-bit (default) conversion resolution conversion speeds of up to 200 ksps (12-bit) up to 24 analog input channels (internal and external) multiple internal reference input channels external voltage reference input pins unipolar differential sample-and-hold (s/h) amplifier automated threshold scan and compare operation to pre-evaluate conversion results selectable conversion trigger source fixed length (one word per channel), configurable conversion result buffer four options for results alignment configurable interrupt generation enhanced dma operations with indirect address generation operation during cpu sleep and idle modes the 12-bit a/d converter module is an enhanced version of the 10-bit module offered in earlier pic24 devices. it is a successive approximation register (sar) converter, enhanced with 12-bit resolution, a wide range of automatic sampling options, tighter inte- gration with other analog modules and a configurable results buffer. it also includes a unique threshold detect feature that allows the module itself to make simple decisions based on the conversion results, and enhanced opera- tion with the dma controller through peripheral indirect addressing (pia). a simplified block diagram for the module is shown in figure 25-1 . 25.1 basic operation to perform a standard a/d conversion: 1. configure the module: a) configure port pins as analog inputs by setting the appropriate bits in the ansx registers (see section 11.2 configuring analog port pins (ansx) for more information). b) select the voltage reference source to match the expected range on analog inputs (ad1con2<15:13>). c) select the positive and negative multiplexer inputs for each channel (ad1chs<15:0>). d) select the analog conversion clock to match the desired data rate with the processor clock (ad1con3<7:0>). e) select the appropriate sample/ conversion sequence (ad1con1<7:4> and ad1con3<12:8>). f) for channel a scanning operations, select the positive channels to be included (ad1cssh and ad1cssl registers). g) select how conversion results are presented in the buffer (ad1con1<9:8> and ad1con5 register). h) select the interrupt rate (ad1con2<5:2>). i) turn on a/d module (ad1con1<15>). 2. configure the a/d interrupt (if required): a) clear the ad1if bit (ifs0<13>). b) enable the ad1ie interrupt (iec0<13>). c) select the a/d interrupt priority (ipc3<6:4>). 3. if the module is configured for manual sampling, set the samp bit (ad1con1<1>) to begin sampling. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive refer- ence source. for more information on the 12-bit a/d converter, refer to the dspic33/pic24 family reference manual , 12-bit a/d converter with threshold detect (ds39739), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 346 ? 2015 microchip technology inc. figure 25-1: 12-bit a/d converter block diagram (pic24fj1024ga610/gb610 family) comparator 12-bit sar v ref + dac an9 (1) an0 an1 an2 v ref - sample control s/h av ss av dd adc1buf0: adc1buff25 ad1con1 ad1con2 ad1con3 ad1chs ad1chitl ad1chith control logic data formatting input mux control conversion control internal data bus 16 v r + v r - mux b v inh v inl v inh v inh v inl v inl v r + v r - v r select v bg ad1cssl ad1cssh note 1: an16 through an23 are not implemented on 64-pin devices. 2: ctmu current source is routed to the selected anx pin when samp = 1 and tgen = 0 . see section 28.0 charge time measurement unit (ctmu) for details. temperature av ss av dd ad1con5 dma data bus 16 ad1con4 ad1dmbuf extended dma data conversion logic mux a an10 (1) an11 (1) an23 (1) diode ctmu current source (2) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 347 pic24fj1024ga610/gb610 family 25.2 extended dma operations in addition to the standard features available on all 12-bit a/d converters, pic24fj1024ga610/gb610 family devices implement a limited extension of dma func- tionality. this extension adds features that work with the devices dma controller to expand the a/d modules data storage abilities beyond the modules built-in buffer. the extended dma functionality is controlled by the dmaen bit (ad1con1<11>); setting this bit enables the functionality. the dmabm bit (ad1con1<12>) configures how the dma feature operates. 25.2.1 extended buffer mode extended buffer mode (dmabm = 1 ) maps the a/d data buffer registers and data from all channels above 26 into a user-specified area of data ram. this allows users to read the conversion results of channels above 26, which do not have their own memory-mapped a/d buffer locations, from data memory. to accomplish this, the dma must be configured in peripheral indirect addressing mode and the dma destination address must point to the beginning of the buffer. the dma count must be set to generate an interrupt after the desired number of conversions. in extended buffer mode, the a/d control bits will function similarly to non-dma modes. the bufregen bit will still select between fifo mode and channel-aligned mode, but the number of words in the destination fifo will be determined by the smpi<4:0> bits in dma mode. in fifo mode, the bufm bit will still split the output fifo into two sets of 13 results (the smpix bits should be set accord- ingly), and the bufs bit will still indicate which set of results is being written to and which can be read. 25.2.2 pia mode when dmabm = 0 , the a/d module is configured to function with the dma controller for peripheral indirect addressing (pia) mode operations. in this mode, the a/d module generates an 11-bit indirect address (ia). this is ored with the destination address in the dma controller to define where the a/d conversion data will be stored. in pia mode, the buffer space is created as a series of contiguous smaller buffers, one per analog channel. the size of the channel buffer determines how many analog channels can be accommodated. the size of the buffer is selected by the dmabl<2:0> bits (ad1con4<2:0>). the size options range from a single word per buffer to 128 words. each channel is allocated a buffer of this size, regardless of whether or not the channel will actually have conversion data. the ia is created by combining the base address within a channel buffer with three to five bits (depending on the buffer size) to identify the channel. the base address ranges from zero to seven bits wide, depend- ing on the buffer size. the address is right-padded with a 0 in order to maintain address alignment in the data space. the concatenated channel and base address bits are then left-padded with zeros, as necessary, to complete the 11-bit ia. the ia is configured to auto-increment which channel is written in each analog inputs sub-buffer during write operations by using the smpix bits (ad1con2<6:2>). as with pia operations for any dma-enabled module, the base destination address in the dmadstn register must be masked properly to accommodate the ia. table 25-1 shows how complete addresses are formed. note that the address masking varies for each buffer size option. because of masking requirements, some address ranges may not be available for certain buffer sizes. users should verify that the dma base address is compatible with the buffer size selected. figure 25-2 shows how the parts of the address define the buffer locations in data memory. in this case, the module allocates 256 bytes of data ram (1000h to 1100h) for 32 buffers of four words each. however, this is not a hard allocation and nothing prevents these locations from being used for other purposes. for example, in the current case, if analog channels 1, 3 and 8 are being sampled and converted, conversion data will only be written to the channel buffers, starting at 1008h, 1018h and 1040h. the holes in the pia buffer space can be used for any other purpose. it is the users responsibility to keep track of buffer locations and prevent data overwrites. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 348 ? 2015 microchip technology inc. 25.3 registers the 12-bit a/d converter is controlled through a total of 13 registers: ad1con1 through ad1con5 ( register 25-1 through register 25-5 ) ad1chs ( register 25-6 ) ad1chith and ad1chitl ( register 25-8 and register 25-9 ) ad1cssh and ad1cssl ( register 25-10 and register 25-11 ) ad1ctmenh and ad1ctmenl ( register 25-12 and register 25-13 ) ad1dmbuf (not shown) C the 16-bit conversion buffer for extended buffer mode table 25-1: indirect address generation in pia mode dmabl<2:0> buffer size per channel (words) generated offset address (lower 11 bits) available input channels allowable dmadstn addresses 000 1 000 00cc ccc0 32 xxxx xxxx xx00 0000 001 2 000 0ccc ccn0 32 xxxx xxxx x000 0000 010 4 000 cccc cnn0 32 xxxx xxxx 0000 0000 011 8 00c cccc nnn0 32 xxxx xxx0 0000 0000 100 16 0cc cccn nnn0 32 xxxx xx00 0000 0000 101 32 ccc ccnn nnn0 32 xxxx x000 0000 0000 110 64 ccc cnnn nnn0 16 xxxx x000 0000 0000 111 128 ccc nnnn nnn0 8 xxxx x000 0000 0000 legend: ccc = channel number (three to five bits), n = base buffer address (zero to seven bits), x = user-definable range of dmadstn for base address, 0 = masked bits of dmadstn for ia downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 349 pic24fj1024ga610/gb610 family 25.4 achieving maximum a/d converter (adc) performance in order to get the shortest overall conversion time (called the throughput) while maintaining accuracy, several factors must be considered. these are described in detail below. dependence of av dd C if the av dd supply is < 2.7v, the charge pump enable bit (pumpen, ad1con3<13>) should be set to 1 . the input channel multiplexer has a varying resistance with av dd (the lower av dd , the higher the internal switch resistance). the charge pump provides a higher internal av dd to keep the switch resistance as low as possible. dependence on t ad C the adc timing is driven by t ad , not t cyc . selecting the t ad time correctly is critical to getting the best adc throughput. it is important to note that the overall adc throughput is not simply the conversion time of the sar; it is the combination of the conversion time, the sample time and additional t ad delays for internal synchronization logic. relationship between t cyc and t ad C there is not a fixed 1:1 timing relationship between t cyc and t ad . the fastest possible throughput is funda- mentally set by t ad (min), not by t cyc . the t ad time is set as a programmable integer multiple of t cyc by the adcs<7:0> bits. referring to table 33-26 , the t ad (min) time is greater than the 4 mhz period of the dedicated adc rc clock generator. therefore, t ad must be 2 t cyc in order to use the rc clock for fastest throughput. the t ad (min) is a multiple of 3.597 mhz as opposed to 4 mhz. to run as fast as possible, t cyc must be a multiple of t ad (min) because values of adcsx are integers. for example, if a standard color burst crystal of 14.31818 mhz is used, t cyc is 279.4 ns, which is very close to t ad (min) and the adc throughput is optimal. running at 16 mhz will actually reduce the throughput, because t ad will have to be 500 ns as the t cyc of 250 ns violates t ad (min). dependence on driving source resistance (r s ) C certain transducers have high output impedance (> 2.5 k ? ). having a high r s will require longer sampling time to charge the s/h capacitor through the resistance path (see figure 25-3 ). the worst case scenario is a full-range voltage step of av ss to av dd , with the sampling cap at av ss . the capacitor time constant is (r s + r ic + r ss ) (c hold ) and the sample time needs to be 6 time constants minimum (8 preferred). since the adc logic timing is t ad -based, the sample time (in t ad ) must be long enough, over all conditions, to charge/discharge c hold . do not assume one t ad is sufficient sample time; longer times may be required to achieve the accuracy needed by the application. the value of c hold is 40 pf. a small amount of charge is present at the adc input pin when the sample switch is closed. if r s is high, this will generate a dc error exceeding 1 lsb. keeping r s < 50 ? is recommenced for best results. the error can also be reduced by increasing sample time (a 2 k ? value of r s requires a 3 s sample time to eliminate the error). calculating throughput C the throughput of the adc is based on t ad . the throughput is given by: where: sample time is the calculated t ad periods for the application. sar conversion time is 12 t ad for 10-bit and 14 t ad for 12-bit conversions. clock sync time is 2.5 t ad (worst case scenario). for example, using an 8 mhz frc means the t cyc = 250 ns. this requires: t ad = 2 t cyc = 500 ns. therefore, the throughput is: note that the clock sync delay could be as little as 1.5 t ad , which could produce 121 ks/sec, but that cannot be ensured as the timing relationship is asynchronous and not specified. the worst case timing of 2.5 t ad should be used to calculate throughput. for example, if a certain transducer has a 20 k ? output impedance, the maximum sample time is determined by: if t ad = 500 ns, this requires a sample time of 4.95 us/ 500 ns = 10 t ad (for a full-step voltage on the transducer output). throughput = 1 sample time + sar conversion time + clock sync time ) ( throughput = 1 500 ns + 14 500 ns + 2.5 500 ns ) ( = 114.28 ks/sec sample time = 6 (r s + r ic + r ss ) c hold = 6 (20k + 250 + 350) 40 pf = 4.95 s downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 350 ? 2015 microchip technology inc. figure 25-2: example of buffer address generation in pia mode (4-word buffers per channel) data ram destination a/d module (pia mode) bba dma channel dmadstn nn (0-3) 1000h (dma base address) range channel ccccc (0-31) 000 cccc cnn0 (ia) 1000h dmabl<2:0> = 010 (4 words per input) 1008h 1010h 1018h 10f8h 1100h ch 0 buffer (4 words) ch 1 buffer (4 words) ch 2 buffer (4 words) ch 3 buffer (4 words) ch 29 buffer (4 words) ch 29 buffer (4 words) ch 31 buffer (4 words) 10f0h (buffer base address) 1000h 1002h 1004h 1006h ch 0, word 0 ch 0, word 1 ch 0, word 2 ch 0, word 3 ch 1, word 0 ch 1, word 1 ch 1, word 2 ch 1, word 3 1008h 100ah 100ch 100eh 0001 0 000 0000 0000 0001 0 000 0000 0010 0001 0 000 0000 0100 0001 0 000 0000 0110 0001 0 000 0000 1000 0001 0 000 0000 1010 0001 0 000 0000 1100 0001 0 000 0000 1110 dma base address address mask channel address buffer address 1038h 1040h ch 7 buffer (4 words) ch 8 buffer (4 words) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 351 pic24fj1024ga610/gb610 family register 25-1: ad1con1: a/d control register 1 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 adon a d s i d l d m a b m ( 1 ) dmaen mode12 form1 form0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0, hsc r/c-0, hsc ssrc3 ssrc2 ssrc1 ssrc0 asam samp done bit 7 bit 0 legend: c = clearable bit u = unimplemented bit, read as 0 r = readable bit w = writable bit hsc = hardware settable/clearable bit -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 adon: a/d operating mode bit 1 = a/d converter is operating 0 = a/d converter is off bit 14 unimplemented: read as 0 bit 13 adsidl: a/d stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 dmabm: extended dma buffer mode select bit ( 1 ) 1 = extended buffer mode: buffer address is defined by the dmadstn register 0 = pia mode: buffer addresses are defined by the dma controller and ad1con4<2:0> bit 11 dmaen: extended dma/buffer enable bit 1 = extended dma and buffer features are enabled 0 = extended features are disabled bit 10 mode12: a/d 12-bit operation mode bit 1 = 12-bit a/d operation 0 = 10-bit a/d operation bit 9-8 form<1:0>: data output format bits ( see formats following) 11 = fractional result, signed, left justified 10 = absolute fractional result, unsigned, left justified 01 = decimal result, signed, right justified 00 = absolute decimal result, unsigned, right justified bit 7-4 ssrc<3:0>: sample clock source select bits 0000 = samp is cleared by software 0001 = int0 0010 = timer3 0100 = ctmu trigger 0101 = timer1 (will not trigger during sleep mode) 0110 = timer1 (may trigger during sleep mode) 0111 = auto-convert mode bit 3 unimplemented: read as 0 bit 2 asam: a/d sample auto-start bit 1 = sampling begins immediately after last conversion; samp bit is auto-set 0 = sampling begins when samp bit is manually set note 1: this bit is only available when extended dma and buffer features are available (dmaen = 1 ). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 352 ? 2015 microchip technology inc. bit 1 samp: a/d sample enable bit 1 = a/d sample-and-hold amplifiers are sampling 0 = a/d sample-and-hold amplifiers are holding bit 0 done: a/d conversion status bit 1 = a/d conversion cycle has completed 0 = a/d conversion cycle has not started or is in progress register 25-1: ad1con1: a/d control register 1 (continued) note 1: this bit is only available when extended dma and buffer features are available (dmaen = 1 ). downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 353 pic24fj1024ga610/gb610 family register 25-2: ad1con2: a/d control register 2 r/w-0 r/w-0 r/w-0 r-0 r/w-0 r/w-0 u-0 u-0 pvcfg1 pvcfg0 nvcfg0 bufregen cscna bit 15 bit 8 r-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 bufs smpi4 smpi3 smpi2 smpi1 smpi0 bufm alts bit 7 bit 0 legend: r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-14 pvcfg<1:0>: a/d converter positive voltage reference configuration bits 1x = unimplemented, do not use 01 =external v ref + 00 =av dd bit 13 nvcfg0: a/d converter negative voltage reference configuration bit 1 = external v ref - 0 = av ss bit 12 reserved: maintain as 0 bit 11 bufregen: a/d buffer register enable bit 1 = conversion result is loaded into the buffer location determined by the converted channel 0 = a/d result buffer is treated as a fifo bit 10 cscna: scan input selections for ch0+ during sample a bit 1 = scans inputs 0 = does not scan inputs bit 9-8 unimplemented: read as 0 bit 7 bufs: buffer fill status bit when dmaen = 1 a nd dmabm = 1 : 1 = a/d is currently filling the destination buffer from [buffer start + (buffer size/2)] to [buffer start + (buffer size C 1)]. user should access data located from [buffer start] to [buffer start + (buffer size/2) C 1]. 0 = a/d is currently filling the destination buffer from [buffer start] to [buffer start + (buffer size/2) C 1]. user should access data located from [buffer start + (buffer size/2)] to [buffer star t + (buffer size C 1)]. when dmaen = 0 : 1 = a/d is currently filling adc1buf13-adc1buf25, user should access data in adc1buf0-adc1buf12 0 = a/d is currently filling adc1buf0-adc1buf12, user should access data in adc1buf13-adc1buf25 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 354 ? 2015 microchip technology inc. bit 6-2 smpi<4:0>: interrupt sample/dma increment rate select bits when dmaen = 1 a nd dmabm = 0 : 11111 = increments the dma address after completion of the 32nd sample/conversion operation 11110 = increments the dma address after completion of the 31st sample/conversion operation 00001 = increments the dma address after completion of the 2nd sample/conversion operation 00000 = increments the dma address after completion of each sample/conversion operation when dmaen = 1 a nd dmabm = 1 : 11111 = resets the dma offset after completion of the 32nd sample/conversion operation 11110 = resets the dma offset after completion of the 31nd sample/conversion operation 00001 = resets the dma offset after completion of the 2nd sample/conversion operation 00000 = resets the dma offset after completion of every sample/conversion operation when dmaen = 0 : 11111 = interrupts at the completion of the conversion for each 32nd sample 11110 = interrupts at the completion of the conversion for each 31st sample 00001 = interrupts at the completion of the conversion for every other sample 00000 = interrupts at the completion of the conversion for each sample bit 1 bufm: buffer fill mode select bit 1 = starts buffer filling at adc1buf0 on first interrupt and adc1buf13 on next interrupt 0 = always starts filling buffer at adc1buf0 bit 0 alts: alternate input sample mode select bit 1 = uses channel input selects for sample a on first sample and sample b on next sample 0 = always uses channel input selects for sample a register 25-2: ad1con2: a/d control register 2 (continued) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 355 pic24fj1024ga610/gb610 family register 25-3: ad1con3: a/d control register 3 r/w-0 r-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 adrc ( 1 ) extsam pumpen ( 2 ) samc4 samc3 samc2 samc1 samc0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 adcs7 adcs6 adcs5 adcs4 adcs3 adcs2 adcs1 adcs0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 adrc: a/d conversion clock source bit ( 1 ) 1 = dedicated adc rc clock generator (4 mhz nominal) 0 = clock derived from system clock bit 14 extsam: extended sampling time bit 1 = a/d is still sampling after samp = 0 0 = a/d is finished sampling bit 13 pumpen: charge pump enable bit ( 2 ) 1 = charge pump for switches is enabled 0 = charge pump for switches is disabled bit 12-8 samc<4:0>: auto-sample time select bits 11111 = 31 t ad ????? 00001 = 1 t ad 00000 = 0 t ad bit 7-0 adcs<7:0>: a/d conversion clock select bits 11111111 = 256 t cy = t ad ????? 00000001 = 2 t cy =t ad 00000000 = t cy =t ad note 1: selecting the internal adc rc clock requires that adcsx be 1 or greater. setting adcsx = 0 when adrc = 1 will violate the t ad (min) specification. 2: enable the charge pump if av dd is < 2.7v. longer sample times are required due to the increase of the internal resistance of the mux if the charge pump is disabled. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 356 ? 2015 microchip technology inc. register 25-4: ad1con4: a/d control register 4 u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 dmabl<2:0> ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-3 unimplemented: read as 0 bit 2-0 dmabl<2:0>: dma buffer size select bits ( 1 ) 111 = allocates 128 words of buffer to each analog input 110 = allocates 64 words of buffer to each analog input 101 = allocates 32 words of buffer to each analog input 100 = allocates 16 words of buffer to each analog input 011 = allocates 8 words of buffer to each analog input 010 = allocates 4 words of buffer to each analog input 001 = allocates 2 words of buffer to each analog input 000 = allocates 1 word of buffer to each analog input note 1: the dmabl<2:0> bits are only used when ad1con1<11> = 1 and ad1con1<12> = 0 ; otherwise, their value is ignored. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 357 pic24fj1024ga610/gb610 family register 25-5: ad1con5: a/d control register 5 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 asen lpen ctmreq bgreq asint1 asint0 bit 15 bit 8 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 wm1 wm0 cm1 cm0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 asen: auto-scan enable bit 1 = auto-scan is enabled 0 = auto-scan is disabled bit 14 lpen: low-power enable bit 1 = low power is enabled after scan 0 = full power is enabled after scan bit 13 ctmreq: ctmu request bit 1 = ctmu is enabled when the a/d is enabled and active 0 = ctmu is not enabled by the a/d bit 12 bgreq: band gap request bit 1 = band gap is enabled when the a/d is enabled and active 0 = band gap is not enabled by the a/d bit 11-10 unimplemented: read as 0 bit 9-8 asint<1:0>: auto-scan (threshold detect) interrupt mode bits 11 = interrupt after threshold detect sequence has completed and valid compare has occurred 10 = interrupt after valid compare has occurred 01 = interrupt after threshold detect sequence has completed 00 = no interrupt bit 7-4 unimplemented: read as 0 bit 3-2 wm<1:0>: write mode bits 11 = reserved 10 = auto-compare only (conversion results are not saved, but interrupt s are generated when a valid match occurs, as defined by the cmx and asintx bits) 01 = convert and save (conversion results are saved to locations as determined by the register bits when a match occurs, as defined by the cmx bits) 00 = legacy operation (conversion data is saved to a location determined by the buffer register bits) bit 1-0 cm<1:0>: compare mode bits 11 = outside window mode: valid match occurs if the conversion result is outside of the window defined by the corresponding buffer pair 10 = inside window mode: valid match occurs if the conversion result is inside the window defi ned by the corresponding buffer pair 01 = greater than mode: valid match occurs if the result is greater than the value in the corresponding buffer register 00 = less than mode: valid match occurs if the result is less than the value in the corresponding buffe r register downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 358 ? 2015 microchip technology inc. register 25-6: ad1chs: a/d sample select register r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ch0nb2 ch0nb1 ch0nb0 ch0sb4 ch0sb3 ch0sb2 ch0sb1 ch0sb0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ch0na2 ch0na1 ch0na0 ch0sa4 ch0sa3 ch0sa2 ch0sa1 ch0sa0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-13 ch0nb<2:0>: sample b channel 0 negative input select bits 1xx = unimplemented 01x = unimplemented 001 = unimplemented 000 = av ss bit 12-8 ch0sb<4:0>: sample b channel 0 positive input select bits 11110 = av dd ( 1 ) 11101 = av ss ( 1 ) 11100 = band gap reference (v bg ) ( 1 ) 11011 = reserved 11010 = reserved 11001 = no channels connected (used for ctmu) 11000 = no channels connected (used for ctmu temperature sensor) 10111 = an23 10110 = an22 10101 = an21 10100 = an20 10011 = an19 10010 = an18 10001 = an17 10000 = an16 01111 = an15 01110 = an14 01101 = an13 01100 = an12 01011 = an11 01010 = an10 01001 = an9 01000 = an8 00111 = an7 00110 = an6 00101 = an5 00100 = an4 00011 = an3 00010 = an2 00001 = an1 00000 = an0 bit 7-5 ch0na<2:0>: sample a channel 0 negative input select bits same definitions as for chonb<2:0>. bit 4-0 ch0sa<4:0>: sample a channel 0 positive input select bits same definitions as for chosb<4:0>. note 1: these input channels do not have corresponding memory-mapped result buffers. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 359 pic24fj1024ga610/gb610 family register 25-7: ancfg: a/d band gap reference configuration register u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 vbgusb ( 1 ) vbgadc ( 1 ) vbgcmp ( 1 ) vbgen ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-4 unimplemented: read as 0 bit 3 vbgusb: band gap reference enable for usb bit ( 1 ) 1 = band gap reference is enabled 0 = band gap reference is disabled bit 2 vbgadc: band gap reference enable for a/d bit ( 1 ) 1 = band gap reference is enabled 0 = band gap reference is disabled bit 1 vbgcmp: band gap reference enable for ctmu and comparator bit ( 1 ) 1 = band gap reference is enabled 0 = band gap reference is disabled bit 0 vbgen: band gap reference enable for vreg, bor, hlvd, frc, dco, nvm and a/d boost bit ( 1 ) 1 = band gap reference is enabled 0 = band gap reference is disabled note 1: when a module requests a band gap reference voltage, that reference will be enabled automatically after a brief start-up time. the user can manually enable the band gap references using the ancfg register before enabling the module requesting the band gap reference to avoid this startup time (~1 ms). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 360 ? 2015 microchip technology inc. register 25-8: ad1chith: a/d scan compare hit register (high word) ( 1 ) u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 chh<25:24> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 chh<23:16> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-10 unimplemented: read as 0 bit 9-0 chh<25:16>: a/d compare hit bits if cm<1:0> = 11 : 1 = a/d result buffer n has been written with data or a match has occurred 0 = a/d result buffer n has not been written with data for all other values of cm<1:0>: 1 = a match has occurred on a/d result channel n 0 = no match has occurred on a/d result channel n note 1: ad1chith is not available on 64-pin parts. register 25-9: ad1chitl: a/d scan compare hit register (low word) ( 1 ) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 chh<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 chh<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 chh<15:0>: a/d compare hit bits if cm<1:0> = 11 : 1 = a/d result buffer n has been written with data or a match has occurred 0 = a/d result buffer n has not been written with data for all other values of cm<1:0>: 1 = a match has occurred on a/d result channel n 0 = no match has occurred on a/d result channel n note 1: ad1chitl is not available on 64-pin parts. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 361 pic24fj1024ga610/gb610 family register 25-10: ad1cssh: a/d input scan select register (high word) u-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 css<30:28> css<26:24> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 css<23:16> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-12 css<30:28>: a/d input scan selection bits 1 = includes corresponding channel for input scan 0 = skips channel for input scan bit 11 unimplemented: read as 0 bit 10-0 css<26:16>: a/d input scan selection bits 1 = includes corresponding channel for input scan 0 = skips channel for input scan register 25-11: ad1cssl: a/d input scan select register (low word) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 css<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 css<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 css<15:0>: a/d input scan selection bits 1 = includes corresponding channel for input scan 0 = skips channel for input scan downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 362 ? 2015 microchip technology inc. register 25-12: ad1ctmenh: a/d ctmu enable register (high word) u-0 r/w-0 r/w-0 r/w-0 u-0 u-0 r/w-0 r/w-0 c t m e n < 3 0 : 2 8 > ctmen<25:24> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ctmen<23:16> ( 1 ) bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 unimplemented: read as 0 bit 14-12 ctmen<30:28>: ctmu enabled during conversion bits 1 = ctmu is enabled and connected to the selected channel during conversion 0 = ctmu is not connected to this channel bit 11-10 unimplemented: read as 0 bit 9-0 ctmen<25:16>: ctmu enabled during conversion bits ( 1 ) 1 = ctmu is enabled and connected to the selected channel during conversion 0 = ctmu is not connected to this channel note 1: ctmen<23:16> bits are not available on 64-pin parts. register 25-13: ad1ctmenl: a/d ctmu enable register (low word) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ctmen<15:8> bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ctmen<7:0> bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-0 ctmen<15:0>: ctmu enabled during conversion bits 1 = ctmu is enabled and connected to the selected channel during conversion 0 = ctmu is not connected to this channel downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 363 pic24fj1024ga610/gb610 family figure 25-3: 12-bit a/d converter analog input model equation 25-1: a/d conversion clock period c pin va rs anx i leakage r ic ? 250 ? sampling switch r ss c hold av ss = 40 pf ? 500 na legend: c pin v t i leakage r ic r ss c hold = input capacitance = threshold voltage = leakage current at the pin due to = interconnect resistance = sampling switch resistance = sample/hold capacitance various junctions note: the c pin value depends on the device package and is not tested. the effect of c pin is negligible if rs ? 2.5 k ? . (r ss ? 3 k ? ) av dd v t = 0.6v v t = 0.6v ss C s/h + = s/h input capacitance sampling switch r min r max av ddmin av dd (v) av ddmax t ad = t cy (adcs + 1 ) adcs = C 1 t ad t cy note: based on t cy = 2/f osc ; doze mode and pll are disabled. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 364 ? 2015 microchip technology inc. figure 25-4: 12-bit a/d transfer function 0010 0000 0001 (2049) 0010 0000 0010 (2050) 0010 0000 0011 (2051) 0001 1111 1101 (2045) 0001 1111 1110 (2046) 0001 1111 1111 (2047) 1111 1111 1110 (4094) 1111 1111 1111 (4095) 0000 0000 0000 (0) 0000 0000 0001 (1) output code 0010 0000 0000 (2048) (v inh C v inl ) v r- v r+ C v r- 4096 2048 * (v r+ C v r- ) 4096 v r+ v r- + v r- + 4095 * (v r+ C v r- ) 4096 v r- + 0 (binary (decimal)) voltage level downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 365 pic24fj1024ga610/gb610 family figure 25-5: 10-bit a/d transfer function 10 0000 0001 (513) 10 0000 0010 (514) 10 0000 0011 (515) 01 1111 1101 (509) 01 1111 1110 (510) 01 1111 1111 (511) 11 1111 1110 (1022) 11 1111 1111 (1023) 00 0000 0000 (0) 00 0000 0001 (1) output code 10 0000 0000 (512) (v inh C v inl ) v r- v r+ C v r- 1024 512 * (v r+ C v r- ) 1024 v r+ v r- + v r- + 1023 * (v r+ C v r- ) 1024 v r- + 0 (binary (decimal)) voltage level downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 366 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 367 pic24fj1024ga610/gb610 family 26.0 triple comparator module the triple comparator module provides three dual input comparators. the inputs to the comparator can be configured to use any one of five external analog inputs (cxina, cxinb, cxinc, cxind and cv ref +) and a voltage reference input from one of the internal band gap references or the comparator voltage reference generator (v bg and cv ref ). the comparator outputs may be directly connected to the cxout pins. when the respective coe bit equals 1 , the i/o pad logic makes the unsynchronized output of the comparator available on the pin. a simplified block diagram of the module in shown in figure 26-1 . diagrams of the possible individual comparator configurations are shown in figure 26-2 through figure 26-4 . each comparator has its own control register, cmxcon ( register 26-1 ), for enabling and configuring its operation. the output and event status of all three comparators is provided in the cmstat register ( register 26-2 ). figure 26-1: triple comp arator module block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference man- ual , scalable comparator module (ds39734), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. c1 v in - v in + cxinb cxinc cxina cxind cv ref + v bg c2 v in - v in + c3 v in - v in + coe c1out pin cpol trigger/interrupt logic cevt evpol<1:0> cout input select logic cch<1:0> cref coe c2out pin cpol trigger/interrupt logic cevt evpol<1:0> cout coe c3out pin cpol trigger/interrupt logic cevt evpol<1:0> cout cv ref + C cvrefm<1:0> (1) cvrefp (1) + 01 0010 11 0011 1 0 01 note 1: refer to the cvrcon register ( register 27-1 ) for bit details. comparator voltage reference downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 368 ? 2015 microchip technology inc. figure 26-2: individual comparator configurations when cref = 0 figure 26-3: individual comparator configurations when cref = 1 and cvrefp = 0 cx v in - v in + off (read as 0 ) comparator off cen = 0 , cref = x , cch<1:0> = xx comparator cxinb > cxina compare cen = 1 , cch<1:0> = 00 , cvrefm<1:0> = xx coe cxout cx v in - v in + coe cxinbcxina comparator cxind > cxina compare cen = 1 , cch<1:0> = 10 , cvrefm<1:0> = xx cx v in - v in + coe cxout cxindcxina comparator cxinc > cxina compare cx v in - v in + coe cxinccxina comparator v bg > cxina compare cx v in - v in + coe v bg cxina pin pin cxout pin cxout pin cxout pin comparator cv ref + > cxina compare cx v in - v in + coe cxout cv ref + cxina pin cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 11 cen = 1 , cch<1:0> = 01 , cvrefm<1:0> = xx cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 00 comparator cxind > cv ref compare cx v in - v in + coe cxindcv ref cxout pin comparator v bg > cv ref compare cx v in - v in + coe v bg cv ref cxout pin comparator cxinc > cv ref compare cx v in - v in + coe cxinc cv ref cxout pin comparator cxinb > cv ref compare cen = 1 , cch<1:0> = 00 , cvrefm<1:0> = xx cx v in - v in + coe cxinbcv ref cxout pin comparator cv ref + > cv ref compare cx v in - v in + coe cv ref + cv ref cxout pin cen = 1 , cch<1:0> = 10 , cvrefm<1:0> = xx cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 11 cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 00 cen = 1 , cch<1:0> = 01 , cvrefm<1:0> = xx downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 369 pic24fj1024ga610/gb610 family figure 26-4: individual comparator configurations when cref = 1 and cvrefp = 1 comparator cxind > cv ref compare cx v in - v in + coe cxind cv ref + cxout pin comparator v bg > cv ref compare cx v in - v in + coe v bg cv ref + cxout pin comparator cxinc > cv ref compare cx v in - v in + coe cxinc cv ref + cxout pin comparator cxinb > cv ref compare cx v in - v in + coe cxinbcv ref + cxout pin cen = 1 , cch<1:0> = 00 , cvrefm<1:0> = xx cen = 1 , cch<1:> = 10 , cvrefm<1:0> = xx cen = 1 , cch<1:0> = 11 , cvrefm<1:0> = 00 cen = 1 , cch<1:0> = 01 , cvrefm<1:0> = xx downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 370 ? 2015 microchip technology inc. register 26-1: cmxcon: comp arator x control registers (comparators 1 through 3) r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 r/w-0, hs r-0, hsc cen coe cpol cevt cout bit 15 bit 8 r/w-0 r/w-0 u-0 r/w-0 u-0 u-0 r/w-0 r/w-0 evpol1 evpol0 cref cch1 cch0 bit 7 bit 0 legend: hs = hardware settable bit hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 cen: comparator enable bit 1 = comparator is enabled 0 = comparator is disabled bit 14 coe: comparator output enable bit 1 = comparator output is present on the cxout pin 0 = comparator output is internal only bit 13 cpol: comparator output polarity select bit 1 = comparator output is inverted 0 = comparator output is not inverted bit 12-10 unimplemented: read as 0 bit 9 cevt: comparator event bit 1 = comparator event that is defined by evpol<1:0> has occurred; subsequent triggers an d interrupts are disabled until the bit is cleared 0 = comparator event has not occurred bit 8 cout: comparator output bit when cpol = 0 : 1 =v in + > v in - 0 =v in + < v in - when cpol = 1 : 1 =v in + < v in - 0 =v in + > v in - bit 7-6 evpol<1:0>: trigger/event/interrupt polarity select bits 11 = trigger/event/interrupt is generated on any change of the comparator output (while cevt = 0 ) 10 = trigger/event/interrupt is generated on transition of the comparator output: if cpol = 0 ( non-inverted polarity): high-to-low transition only. if cpol = 1 ( inverted polarity): low-to-high transition only. 01 = trigger/event/interrupt is generated on transition of comparator output: if cpol = 0 ( non-inverted polarity): low-to-high transition only. if cpol = 1 ( inverted polarity): high-to-low transition only. 00 = trigger/event/interrupt generation is disabled bit 5 unimplemented: read as 0 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 371 pic24fj1024ga610/gb610 family bit 4 cref: comparator reference select bit (non-inverting input) 1 = non-inverting input connects to the internal cv ref voltage 0 = non-inverting input connects to the cxina pin bit 3-2 unimplemented: read as 0 bit 1-0 cch<1:0>: comparator channel select bits 11 = inverting input of the comparator connects to the internal selectable reference voltage specified by the cvrefm<1:0> bits in the cvrcon register 10 = inverting input of the comparator connects to the cxind pin 01 = inverting input of the comparator connects to the cxinc pin 00 = inverting input of the comparator connects to the cxinb pin register 26-1: cmxcon: comp arator x control registers (comparators 1 through 3) (continued) register 26-2: cmstat: comparat or module status register r/w-0 u-0 u-0 u-0 u-0 r-0, hsc r-0, hsc r-0, hsc cmidl c3evt c2evt c1evt bit 15 bit 8 u-0 u-0 u-0 u-0 u-0 r-0, hsc r-0, hsc r-0, hsc c3out c2out c1out bit 7 bit 0 legend: hsc = hardware settable/clearable bit r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 cmidl: comparator stop in idle mode bit 1 = discontinues operation of all comparators when device enters idle mode 0 = continues operation of all enabled comparators in idle mode bit 14-11 unimplemented: read as 0 bit 10 c3evt: comparator 3 event status bit (read-only) shows the current event status of comparator 3 (cm3con<9>). bit 9 c2evt: comparator 2 event status bit (read-only) shows the current event status of comparator 2 (cm2con<9>). bit 8 c1evt: comparator 1 event status bit (read-only) shows the current event status of comparator 1 (cm1con<9>). bit 7-3 unimplemented: read as 0 bit 2 c3out: comparator 3 output status bit (read-only) shows the current output of comparator 3 (cm3con<8>). bit 1 c2out: comparator 2 output status bit (read-only) shows the current output of comparator 2 (cm2con<8>). bit 0 c1out: comparator 1 output status bit (read-only) shows the current output of comparator 1 (cm1con<8>). downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 372 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 373 pic24fj1024ga610/gb610 family 27.0 comparator voltage reference 27.1 configuring the comparator voltage reference the voltage reference module is controlled through the cvrcon register ( register 27-1 ). the comparator voltage reference provides two ranges of output voltage, each with 32 distinct levels. the comparator reference supply voltage can come from either v dd and v ss , or the external v ref + and v ref -. the voltage source is selected by the cvrss bit (cvrcon<5>). the settling time of the comparator voltage reference must be considered when changing the cv ref output. figure 27-1: comparator voltage reference block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the dspic33/pic24 family reference man- ual , dual comparator module (ds39710), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. 32-to-1 mux cvr<4:0> r cvren cvrss = 0 av dd cv ref + cvrss = 1 cvrss = 0 cv ref - cvrss = 1 rr r r r r 32 steps cv ref av ss cvroe cv ref pin downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 374 ? 2015 microchip technology inc. register 27-1: cvrcon: comparator vo ltage reference control register u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 cvrefp cvrefm1 cvrefm0 bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 cvren cvroe cvrss cvr4 cvr3 cvr2 cvr1 cvr0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-11 unimplemented: read as 0 bit 10 cvrefp: comparator voltage reference select bit (valid only when cref is 1 ) 1 = cv ref + is used as a reference voltage to the comparators 0 = the cvr<4:0> bits (5-bit dac) within this module provide the refere nce voltage to the comparators bit 9-8 cvrefm<1:0>: comparator band gap reference source select bits (valid only when cch<1:0> = 11 ) 00 = band gap voltage is provided as an input to the comparators 01 = reserved 10 = reserved 11 = cv ref + pin is provided as an input to the comparators bit 7 cvren: comparator voltage reference enable bit 1 = cv ref circuit is powered on 0 = cv ref circuit is powered down bit 6 cvroe: comparator v ref output enable bit 1 = cv ref voltage level is output on the cv ref pin 0 = cv ref voltage level is disconnected from the cv ref pin bit 5 cvrss: comparator v ref source selection bit 1 = comparator reference source, cv rsrc = cv ref + C cv ref - 0 = comparator reference source, cv rsrc = av dd C av ss bit 4-0 cvr<4:0>: comparator v ref value selection 0 ? cvr<4:0> ? 31 bits when cvr ss = 1 : cv ref = (cv ref -) + (cvr<4:0>/32) ? (cv ref + C cv ref -) when cvr ss = 0 : cv ref = (av ss ) + (cvr<4:0>/32) ? (av dd C av ss ) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 375 pic24fj1024ga610/gb610 family 28.0 charge time measurement unit (ctmu) the charge time measurement unit (ctmu) is a flexible analog module that provides charge measurement, accurate differential time measurement between pulse sources and asynchronous pulse generation. its key features include: thirteen external edge input trigger sources polarity control for each edge source control of edge sequence control of response to edge levels or edge transitions time measurement resolution of one nanosecond accurate current source suitable for capacitive measurement together with other on-chip analog modules, the ctmu can be used to precisely measure time, measure capacitance, measure relative changes in capacitance or generate output pulses that are independent of the system clock. the ctmu module is ideal for interfacing with capacitive-based touch sensors. the ctmu is controlled through three registers: ctmucon1l, ctmucon1h and ctmucon2l. ctmucon1l enables the module, controls the mode of operation of the ctmu, controls edge sequencing, selects the current range of the current source and trims the current. ctmucon1h controls edge source selection and edge source polarity selection. the ctmucon2l register selects the current discharge source. 28.1 measuring capacitance the ctmu module measures capacitance by generating an output pulse, with a width equal to the time between edge events, on two separate input channels. the pulse edge events to both input channels can be selected from four sources: two internal peripheral modules (oc1 and timer1) and up to 13 external pins (cted1 through cted13). this pulse is used with the modules precision current source to calculate capacitance according to the relationship: equation 28-1: for capacitance measurements, the a/d converter samples an external capacitor (c app ) on one of its input channels, after the ctmu outputs pulse. a precision resistor (r pr ) provides current source calibration on a second a/d channel. after the pulse ends, the converter determines the voltage on the capacitor. the actual calculation of capacitance is performed in software by the application. figure 28-1 illustrates the external connections used for capacitance measurements, and how the ctmu and a/d modules are related in this application. this example also shows the edge events coming from timer1, but other configurations using external edge sources are possible. a detailed discussion on measuring capacitance and time with the ctmu module is provided in the dspic33/pic24 family ref- erence manual, charge time measurement unit (ctmu) with threshold detect (ds39743). note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information on the charge time measurement unit, refer to the dspic33/pic24 family reference manual , charge time measurement unit (ctmu) with threshold detect (ds39743), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. i = c dv dt downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 376 ? 2015 microchip technology inc. figure 28-1: typical connections and internal configuration for capacitance measurement 28.2 measuring time/routing current source to a/d input pin time measurements on the pulse width can be similarly performed using the a/d modules internal capacitor (c ad ) and a precision resistor for current calibration. figure 28-2 displays the external connections used for time measurements, and how the ctmu and a/d modules are related in this application. this example also shows both edge events coming from the external ctedx pins, but other configurations using internal edge sources are possible. this mode is enabled by clearing the tgen bit (ctmucon1l<12>). the current source is tied to the input of the a/d after the sampling switch. therefore, the a/d bit, samp, must be set to 1 in order for the current to be routed through the channel selection mux to the desired pin. 28.3 pulse generation and delay the ctmu module can also generate an output pulse with edges that are not synchronous with the devices system clock. more specifically, it can generate a pulse with a programmable delay from an edge event input to the module. when the module is configured for pulse generation delay by setting the tgen bit (ctmucon1<12>), the internal current source is connected to the b input of comparator 2. a capacitor (c delay ) is connected to the comparator 2 pin, c2inb, and the comparator voltage reference, cv ref , is connected to c2ina. cv ref is then configured for a specific trip point. the module begins to charge c delay when an edge event is detected. when c delay charges above the cv ref trip point, a pulse is output on ctpls. the length of the pulse delay is determined by the value of c delay and the cv ref trip point. figure 28-3 illustrates the external connections for pulse generation, as well as the relationship of the different analog modules required. while cted1 is shown as the input pulse source, other options are available. a detailed discussion on pulse generation with the ctmu module is provided in the dspic33/ pic24 family reference manual . pic24f device a/d converter ctmu anx c app output pulse edg1 edg2 r pr any timer1 current source downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 377 pic24fj1024ga610/gb610 family figure 28-2: typical connections and internal configuration for time measurement (tgen = 0 ) figure 28-3: typical connections and internal configuration for pulse delay generation (tgen = 1 ) pic24f device a/d converter ctmu ctedx ctedx anx output pulse edg1 edg2 c ad r pr current source c2 cv ref ctpls pic24f device current source comparator ctmu ctedx c2inb c delay edg1 C downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 378 ? 2015 microchip technology inc. 28.4 measuring die temperature the ctmu can be configured to use the a/d to measure the die temperature using dedicated a/d channel 24. perform the following steps to measure the diode voltage: the internal current source must be set for either 5.5 a (irng<1:0> = 0x2) or 55 a (irng<1:0> = 0x3). in order to route the current source to the diode, the edg1stat and edg2stat bits must be equal (either both 0 or both 1 ). the ctmreq bit (ad1con5<13>) must be set to 1 . the a/d channel select bits must be 24 (0x18) using a single-ended measurement. the voltage of the diode will vary over temperature according to the graphs shown below ( figure 28-4 ). note that the graphs are different, based on the magnitude of the current source selected. the slopes are nearly linear over the range of -40oc to +100oc and the temperature can be calculated as follows: equation 28-2: figure 28-4: diode voltage (mv) vs. die temperature (typical) 710 mv C vdiode 1.8 tdie = 760 mv C vdiode 1.55 tdie = for 5.5 a current source: where vdiode is in mv , tdie is in oc for 55 a current source: where vdiode is in mv , tdie is in oc 450 475 500 525 550 575 600 625 650 675 700 725 750 775 800 825 850 - 4 0- 2 00 2 04 06 08 01 0 01 2 0 5.5ua 55ua diode voltage (mv) die temperature (c) 5.5 a 55 a downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 379 pic24fj1024ga610/gb610 family register 28-1: ctmucon1l: ct mu control register 1 low r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ctmuen ctmusidl tgen edgen edgseqen idissen cttrig bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 itrim5 itrim4 itrim3 itrim2 itrim1 itrim0 irng1 irng0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 ctmuen: ctmu enable bit 1 = module is enabled 0 = module is disabled bit 14 unimplemented: read as 0 bit 13 ctmusidl: ctmu stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 tgen: time generation enable bit 1 = enables edge delay generation and routes the current source to the comparator pin 0 = disables edge delay generation and routes the current source to the selected a/d input pin bit 11 edgen: edge enable bit 1 = edges are not blocked 0 = edges are blocked bit 10 edgseqen: edge sequence enable bit 1 = edge 1 event must occur before edge 2 event can occur 0 = no edge sequence is needed bit 9 idissen: analog current source control bit 1 = analog current source output is grounded 0 = analog current source output is not grounded bit 8 cttrig: ctmu trigger control bit 1 = trigger output is enabled 0 = trigger output is disabled bit 7-2 itrim<5:0>: current source trim bits 011111 = maximum positive change from nominal current 011110 000001 = minimum positive change from nominal current 000000 = nominal current output specified by irng<1:0> 111111 = minimum negative change from nominal current 100010100001 = maximum negative change from nominal current downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 380 ? 2015 microchip technology inc. bit 1-0 irng<1:0>: current source range select bits if irngh = 0 : 11 = 55 a range 10 = 5.5 a range 01 = 550 na range 00 = 550 a range if irngh = 1 : 11 = reserved 10 = reserved 01 = 2.2 ma range 00 = 550 a range register 28-1: ctmucon1l: ctmu co ntrol register 1 low (continued) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 381 pic24fj1024ga610/gb610 family register 28-2: ctmucon1h: ctmu control register 1 high r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 edg1mod edg1pol edg1sel 3 edg1sel2 edg1sel1 edg1 sel0 edg2stat edg1stat bit 15 bit 8 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 r/w-0 edg2mod edg2pol edg2sel3 edg 2sel2 edg2sel1 edg2sel0 i r n g h bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15 edg1mod: edge 1 edge-sensitive select bit 1 = input is edge-sensitive 0 = input is level-sensitive bit 14 edg1pol: edge 1 polarity select bit 1 = edge 1 is programmed for a positive edge response 0 = edge 1 is programmed for a negative edge response bit 13-10 edg1sel<3:0>: edge 1 source select bits 1111 = cmp c3out 1110 = cmp c2out 1101 = cmp c1out 1100 = ic3 interrupt 1011 = ic2 interrupt 1010 = ic1 interrupt 1001 = cted8 pin 1000 = cted7 pin ( 1 ) 0111 = cted6 pin 0110 = cted5 pin 0101 = cted4 pin 0100 = cted3 pin ( 1 ) 0011 = cted1 pin 0010 = cted2 pin 0001 = oc1 0000 = timer1 match bit 9 edg2stat: edge 2 status bit indicates the status of edge 2 and can be written to control current source. 1 = edge 2 has occurred 0 = edge 2 has not occurred bit 8 edg1stat: edge 1 status bit indicates the status of edge 1 and can be written to control current source. 1 = edge 1 has occurred 0 = edge 1 has not occurred bit 7 edg2mod: edge 2 edge-sensitive select bit 1 = input is edge-sensitive 0 = input is level-sensitive bit 6 edg2pol: edge 2 polarity select bit 1 = edge 2 is programmed for a positive edge response 0 = edge 2 is programmed for a negative edge response note 1: cted3, cted7, cted10 and cted11 are not available on 64-pin packages. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 382 ? 2015 microchip technology inc. bit 5-2 edg2sel<3:0>: edge 2 source select bits 1111 = cmp c3out 1110 = cmp c2out 1101 = cmp c1out 1100 = peripheral clock 1011 = ic3 interrupt 1010 = ic2 interrupt 1001 = ic1 interrupt 1000 = cted13 pin 0111 = cted12 pin 0110 = cted11 pin ( 1 ) 0101 = cted10 pin ( 1 ) 0100 = cted9 pin 0011 = cted1 pin 0010 = cted2 pin 0001 = oc1 0000 = timer1 match bit 1 unimplemented: read as 0 bit 0 irngh: high-current range select bit 1 = uses the higher current ranges (550 a-2.2 ma) 0 = uses the lower current ranges (550 na-50 a) current output is set by the irng<1:0> bits in the ctmucon1l register. register 28-2: ctmucon1h: ctmu control register 1 high (continued) note 1: cted3, cted7, cted10 and cted11 are not available on 64-pin packages. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 383 pic24fj1024ga610/gb610 family register 28-3: ctmucon2l: ct mu control register 2 low u-0 u-0 u-0 u-0 u-0 u-0 u-0 u-0 bit 15 bit 8 u-0 u-0 u-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 i r s t e n dschs2 dschs1 dschs0 bit 7 bit 0 legend: r = readable bit w = writable bit u = unimplemented bit, read as 0 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-5 unimplemented: read as 0 bit 4 irsten: ctmu current source reset enable bit 1 = signal selected by dschs<2:0> bits or idissen control bit will reset ctmu edge detect logic 0 = ctmu edge detect logic will not occur bit 3 unimplemented: read as 0 bit 2-0 dschs<2:0>: discharge source select bits 111 = clc2 out 110 = clc1 out 101 = disabled 100 = a/d end of conversion 011 = mccp3 auxiliary output 010 = mccp2 auxiliary output 001 = mccp1 auxiliary output 000 = disabled downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 384 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 385 pic24fj1024ga610/gb610 family 29.0 high/low-voltage detect (hlvd) the high/low-voltage detect (hlvd) module is a programmable circuit that allows the user to specify both the device voltage trip point and the direction of change. an interrupt flag is set if the device experiences an excursion past the trip point in the direction of change. if the interrupt is enabled, the program execution will branch to the interrupt vector address and the software can then respond to the interrupt. the lvdif flag may be set during a por or bor event. the firmware should clear the flag before the application uses it for the first time, even if the interrupt was disabled. the hlvd control register (see register 29-1 ) completely controls the operation of the hlvd module. this allows the circuitry to be turned off by the user under software control, which minimizes the current consumption for the device. the hlvden bit (hlvdcon<15>) should be cleared when writing data to the hlvdcon register. once the register is config- ured, the module is enabled from power-down by setting hlvden. the application must wait a minimum of 5 s before clearing the hlvdif flag and using the module after hlvden has been set. figure 29-1: high/low-voltage de tect (hlvd) module block diagram note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information on the high/low-voltage detect, refer to the dspic33/pic24 family reference manual , high-level integration with programmable high/low-voltage detect (hlvd) (ds39725), which is available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. set v dd 16-to-1 mux hlvden hlvdl<3:0> hlvdin v dd externally generated trip point lvdif hlvden band gap vdir 1.2v typical downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 386 ? 2015 microchip technology inc. register 29-1: hlvdcon: high/low-v oltage detect control register r/w-0 u-0 r/w-0 u-0 r/w-0 r-1 r-1 r-0, hs, hc hlvden l s i d l vdir bgvst irvst lvdevt ( 2 ) bit 15 bit 8 u-0 u-0 u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 hlvdl3 hlvdl2 hlvdl1 hlvdl0 bit 7 bit 0 legend: hs = hardware settable bit hc = hardware clearable bit r = reserved bit r = readable bit w = writable bit 0 = bit is cleared x = bit is unknown -n = value at por 1 = bit is set u = unimplemented bit, read as 0 bit 15 hlvden: high/low-voltage detect power enable bit 1 = hlvd is enabled 0 = hlvd is disabled bit 14 unimplemented: read as 0 bit 13 lsidl: hlvd stop in idle mode bit 1 = discontinues module operation when device enters idle mode 0 = continues module operation in idle mode bit 12 unimplemented: read as 0 bit 11 vdir: voltage change direction select bit 1 = event occurs when voltage equals or exceeds trip point (hlvdl<3:0>) 0 = event occurs when voltage equals or falls below trip point (hlvdl<3:0>) bit 10 bgvst: reserved bit (value is always 1 ) bit 9 irvst: reserved bit (value is always 1 ) bit 8 lvdevt: low-voltage event status bit ( 2 ) 1 = lvd event is true during current instruction cycle 0 = lvd event is not true during current instruction cycle bit 7-4 unimplemented: read as 0 bit 3-0 hlvdl<3:0>: high/low-voltage detection limit bits 1111 = external analog input is used (input comes from the hlvdin pin) 1110 = trip point 1 ( 1 ) 1101 = trip point 2 ( 1 ) 1100 = trip point 3 ( 1 ) 0100 = trip point 11 ( 1 ) 00xx = unused note 1: for the actual trip point, see section 33.0 electrical characteristics . 2: the lvdif flag cannot be cleared by software unless lvdevt = 0 . the voltage must be monitored so that the hlvd condition (as set by vdir and hlvdl<3:0>) is not asserted. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 387 pic24fj1024ga610/gb610 family 30.0 special features pic24fj1024ga610/gb610 family devices include several features intended to maximize application flexibility and reliability, and minimize cost through elimination of external components. these are: flexible configuration watchdog timer (wdt) code protection jtag boundary scan interface in-circuit serial programming? in-circuit emulation 30.1 configuration bits the configuration bits are stored in the last page loca- tion of implemented program memory. these bits can be set or cleared to select various device configurations. there are two types of configuration bits: system oper- ation bits and code-protect bits. the system operation bits determine the power-on settings for system-level components, such as the oscillator and the watchdog timer. the code-protect bits prevent program memory from being read and written. in dual partition modes, each partition has its own set of flash configuration words. the full set of configuration registers in the active partition is used to determine the devices configuration; the configuration words in the inactive partition are used to determine the devices configuration when that partition becomes active. how- ever, some of the configuration registers in the inactive partition (fsec, fbslim and fsign) may be used to determine how the active partition is able or allowed to access the inactive partition. 30.1.1 considerations for configuring pic24fj1024ga610/ gb610 family devices in pic24fj1024ga610/gb610 family devices, the configuration bytes are implemented as volatile memory. this means that configuration data must be programmed each time the device is powered up. con- figuration data is stored in the three words at the top of the on-chip program memory space, known as the flash configuration words. their specific locations are shown in table 30-1 . the configuration data is auto- matically loaded from the flash configuration words to the proper configuration registers during device resets. after a reset, configuration reads are performed in the following order: device calibration information partition mode configuration (fboot) if single partition mode: user configuration words if dual partition mode: partition 1 boot sequence number partition 2 boot sequence number user configuration words from the active partition code protection user configuration words from the inactive partition when creating applications for these devices, users should always specifically allocate the location of the flash configuration word for configuration data. this is to make certain that program code is not stored in this address when the code is compiled. the upper byte of all flash configuration words in pro- gram memory should always be 0000 0000 . this makes them appear to be nop instructions in the remote event that their locations are ever executed by accident. since configuration bits are not implemented in the corresponding locations, writing 0 s to these locations has no effect on device operation. note: this data sheet summarizes the features of this group of pic24f devices. it is not intended to be a comprehensive reference source. for more information, refer to the following sections of the dspic33/pic24 family reference manual , which are available from the microchip web site ( www.microchip.com ). the information in this data sheet supersedes the information in the frm. watchdog timer (wdt) (ds39697) high-level device integration (ds39719) programming and diagnostics (ds39716) note: configuration data is reloaded on all types of device resets. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 388 ? 2015 microchip technology inc. table 30-1: configuration word addresses configuration registers single partition mode pic24fj1024gx6xx pic24fj512gx6xx pic24fj256gx6xx pic24fj128gx6xx fsec 0abf00h 055f00h 02af00h 015f00h fbslim 0abf10h 055f10h 02af10h 015f10h fsign 0abf14h 055f14h 02af14h 015f14h foscsel 0abf18h 055f18h 02af18h 015f18h fosc 0abf1ch 055f1ch 02af1ch 015f1ch fwdt 0abf20h 055f20h 02af20h 015f20h fpor 0abf24h 055f24h 02af24h 015f24h ficd 0abf28h 055f28h 02af28h 015f28h fdevopt1 0abf2ch 055f2ch 02af2ch 015f2ch fboot 801800h dual partition modes ( 1 ) fsec ( 2 ) 055f00h/455f00h 02af00h/42af00h 015700h/415700h 00af00h/40af00h fbslim ( 2 ) 055f10h/455f10h 02af10h/42af10h 015710h/415710h 00af10h/40af10h fsign ( 2 ) 055f14h/455f14h 02af14h/42af14h 015714h/ 415714h 00af14h/40af14h foscsel 055f18h/455f18h 02af18h/42af18h 015718h/415718h 00af18h/40af18h fosc 055f1ch/455f1ch 02af1ch/42af1ch 01571ch/41571ch 00af1ch/40af1ch fwdt 055f20h/455f20h 02af20h/42af20h 015720h/415720h 00af20h/40af20h fpor 055f24h/ 455f24h 02af24h/42af24h 015724h/415724h 00af24h/40af24h ficd 055f28h/455f28h 02af28h/42af28h 015728h/415728h 00af28h/40af28h fdevopt1 055f2ch/455f2ch 02af2ch/42af2ch 01572ch/41572ch 00af2ch/40af2ch fbtseq ( 3 ) 055ffch/455ffch 02affch/42affch 0157fch/4157fch 00affch/40affch fboot 801800h note 1: addresses shown for dual partition modes are for the active/inactive partitions, respectively. 2: changes to these inactive partition configuration words affect how the active partition accesses the inactive partition. 3: fbtseq is a 24-bit configuration word, using all three bytes of the program memory width. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 389 pic24fj1024ga610/gb610 family register 30-1: fboot configuration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 15 bit 8 u-1 u-1 u-1 u-1 u-1 u-1 r/po-1 r/po-1 b t m o d e < 1 : 0 > bit 7 bit 0 legend: po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 15-2 unimplemented: read as 1 bit 1-0 btmode<1:0>: device partition mode configuration status bits 11 = single partition mode 10 = dual partition mode 01 = protected dual partition mode (partition 1 is write-protected when inactive) 00 = reserved; do not use register 30-2: fbtseq configuration register r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 ibseq11 ibseq10 ibseq9 ibs eq8 ibseq7 ibseq6 ibseq5 ibseq4 bit 23 bit 16 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 ibseq3 ibseq2 ibseq1 ibseq0 bseq11 bseq10 bseq9 bseq8 bit 15 bit 8 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 bseq7 bseq6 bseq5 bseq4 bseq3 bseq2 bseq1 bseq0 bit 7 bit 0 legend: po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-12 ibseq<11:0>: inverse boot sequence number bits (dual partition modes only) the ones complement of bseq<11:0>; must be calculated by the user and written into device programming. bit 11-0 bseq<11:0>: boot sequence number bits (dual partition modes only) relative value defining which partition will be active after a device reset; the partition containing a lower boot number will be active. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 390 ? 2015 microchip technology inc. register 30-3: fsec co nfiguration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 23 bit 16 r/po-1 u-1 u-1 u-1 r/po-1 r/po-1 r/po-1 r/po-1 aivtdis css2 css1 css0 cwrp bit 15 bit 8 r/po-1 r/po-1 r/po-1 u-1 r/po-1 r/po-1 r/po-1 r/po-1 gss1 gss0 gwrp bsen bss1 bss0 bwrp bit 7 bit 0 legend: po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-16 unimplemented: read as 1 bit 15 aivtdis: alternate interrupt vector table disable bit 1 = disables aivt; intcon2<8> (aivten) bit is not available 0 = enables aivt; intcon2<8> (aivten) bit is available bit 14-12 unimplemented: read as 1 bit 11-9 css<2:0>: configuration segment code protection level bits 111 = no protection (other than cwrp) 110 = standard security 10x = enhanced security 0xx = high security bit 8 cwrp: configuration segment program write protection bit 1 = configuration segment is not write-protected 0 = configuration segment is write-protected bit 7-6 gss<1:0>: general segment code protection level bits 11 = no protection (other than gwrp) 10 = standard security 0x = high security bit 5 gwrp: general segment program write protection bit 1 = general segment is not write-protected 0 = general segment is write-protected bit 4 unimplemented: read as 1 bit 3 bsen: boot segment control bit 1 = no boot segment is enabled 0 = boot segment size is determined by bslim<12:0> bit 2-1 bss<1:0> : boot segment code protection level bits 11 = no protection (other than bwrp) 10 = standard security 0x = high security bit 0 bwrp: boot segment program write protection bit 1 = boot segment can be written 0 = boot segment is write-protected downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 391 pic24fj1024ga610/gb610 family register 30-4: fbslim configuration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 23 bit 16 u - 1 u - 1 u - 1 r / p o - 1r / p o - 1r / p o - 1r / p o - 1r / p o - 1 bslim<12:8> bit 15 bit 8 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 bslim<7:0> bit 7 bit 0 legend: po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-13 unimplemented: read as 1 bit 12-0 bslim<12:0>: active boot segment code flash page address limit (inverted) bits this bit field contains the last active boot segment page + 1 (i.e., first page address of gs). the value is stored as an inverted page address, such that programming additional 0 s can only increase the size of bs. if bslim<12:0> is set to all 1 s (unprogrammed default), active boot segment size is zero. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 392 ? 2015 microchip technology inc. \ register 30-5: fsign configuration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 23 bit 16 r-0 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 15 bit 8 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 7 bit 0 legend: po = program once bit r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-16 unimplemented: read as 1 bit 15 reserved: maintain as 0 bit 14-0 unimplemented: read as 1 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 393 pic24fj1024ga610/gb610 family register 30-6: foscsel configuration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 23 bit 16 u-1 u-1 u-1 u-1 u-1 u-1 r-0 r-0 bit 15 bit 8 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 ieso pllmode3 pllmode2 pllmode1 pllmode0 fnosc2 fnosc1 fnosc0 bit 7 bit 0 legend: po = program once bit r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-10 unimplemented: read as 1 bit 9-8 reserved: maintain as 0 bit 7 ieso: two-speed oscillator start-up enable bit 1 = starts up the device with frc, then automatically switches to the user-selected oscillator when ready 0 = starts up the device with the user-selected oscillator source bit 6-3 pllmode<3:0>: frequency multiplier select bits 1111 = no pll is used (pllen bit is unavailable) 1110 = 8x pll is selected 1101 = 6x pll is selected 1100 = 4x pll is selected 0111 = 96 mhz usb pll is selected (input frequency = 48 mhz) 0110 = 96 mhz usb pll is selected (input frequency = 32 mhz) 0101 = 96 mhz usb pll is selected (input frequency = 24 mhz) 0100 = 96 mhz usb pll is selected (input frequency = 20 mhz) 0011 = 96 mhz usb pll is selected (input frequency = 16 mhz) 0010 = 96 mhz usb pll is selected (input frequency = 12 mhz) 0001 = 96 mhz usb pll is selected (input frequency = 8 mhz) 0000 = 96 mhz usb pll is selected (input frequency = 4 mhz) bit 2-0 fnosc<2:0>: oscillator selection bits 111 = oscillator with frequency divider (oscfdiv) 110 = digitally controlled oscillator (dco) 101 = low-power rc oscillator (lprc) 100 = secondary oscillator (sosc) 011 = primary oscillator with pll (xtpll, hspll, ecpll) 010 = primary oscillator (xt, hs, ec) 001 = fast rc oscillator with pll (frcpll) 000 = fast rc oscillator (frc) downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 394 ? 2015 microchip technology inc. register 30-7: fosc co nfiguration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 23 bit 16 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 15 bit 8 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 fcksm1 fcksm0 iol1way pllss ( 1 ) soscsel osciofcn poscmd1 poscmd0 bit 7 bit 0 legend: po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-8 unimplemented: read as 1 bit 7-6 fcksm<1:0>: clock switching and monitor selection bits 1x = clock switching and the fail-safe clock monitor are disabled 01 = clock switching is enabled, fail-safe clock monitor is disabled 00 = clock switching and the fail-safe clock monitor are enabled bit 5 iol1way: peripheral pin select configuration bit 1 = the iolock bit can be set only once (with unlock sequence). 0 = the iolock bit can be set and cleared as needed (with unlock sequence) bit 4 pllss: pll secondary clock source selection configuration bit ( 1 ) this configuration bit only takes effect when the pll is not being used by the system (i.e., not selecte d as part of the system clock source). this bit is used to generate an independent clock out of refo. 1 = pll is fed by the primary oscillator (ec, xt or hs mode) 0 = pll is fed by the on-chip fast rc (frc) oscillator bit 3 soscsel: sosc selection configuration bit 1 = crystal (sosci/sosco) mode 0 = digital (sosci) mode bit 2 osciofcn: clko enable configuration bit 1 = clko output signal is active on the osco pin (when the primary oscillator is disabled or configured for ec mode) 0 = clko output is disabled bit 1-0 poscmd<1:0>: primary oscillator configuration bits 11 = primary oscillator mode is disabled 10 = hs oscillator mode is selected (10 mhz-32 mhz) 01 = xt oscillator mode is selected (1.5 mhz-10 mhz) 00 = external clock mode is selected note 1: when the primary clock source is greater than 8 mhz, this bit must be set to 0 to prevent overclocking the pll. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 395 pic24fj1024ga610/gb610 family register 30-8: fwdt configuration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 23 bit 16 u-1 r/po-1 r/po-1 u-1 r/po-1 u-1 r/po-1 r/po-1 wdtclk1 wdtclk0 wdtcmx wdtwin1 wdtwin0 bit 15 bit 8 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 r/po-1 windis fwdten1 fwdten0 fwpsa wdtps3 wdtps2 wdtps1 wdtps0 bit 7 bit 0 legend: po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-15 unimplemented: read as 1 bit 14-13 wdtclk<1:0>: watchdog timer clock select bits (when wdtcmx = 1 ) 11 = always uses lprc 10 = uses frc when windis = 0 , system clock is not lprc and device is not in sleep; otherwise, uses lprc 01 = always uses sosc 00 = uses peripheral clock when system clock is not lprc and device is not in sleep; otherwise, uses lprc bit 12 unimplemented: read as 1 bit 11 wdtcmx: wdt clock mux control bit 1 = enables wdt clock mux; wdt clock is selected by wdtclk<1:0> 0 = wdt clock is lprc bit 10 unimplemented: read as 1 bit 9-8 wdtwin<1:0>: watchdog timer window width bits 11 = wdt window is 25% of the wdt period 10 = wdt window is 37.5% of the wdt period 01 = wdt window is 50% of the wdt period 00 = wdt window is 75% of the wdt period bit 7 windis: windowed watchdog timer disable bit 1 = windowed wdt is disabled 0 = windowed wdt is enabled bit 6-5 fwdten<1:0>: watchdog timer enable bits 11 = wdt is enabled 10 = wdt is disabled (control is placed on the swdten bit) 01 = wdt is enabled only while device is active and disabled in sleep; swdten bit is disabled 00 = wdt and swdten are disabled bit 4 fwpsa: watchdog timer prescaler bit 1 = wdt prescaler ratio of 1:128 0 = wdt prescaler ratio of 1:32 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 396 ? 2015 microchip technology inc. bit 3-0 wdtps<3:0>: watchdog timer postscale select bits 1111 = 1:32,768 1110 = 1:16,384 1101 = 1:8,192 1100 = 1:4,096 1011 = 1:2,048 1010 = 1:1,024 1001 = 1:512 1000 = 1:256 0111 = 1:128 0110 = 1:64 0101 = 1:32 0100 = 1:16 0011 = 1:8 0010 = 1:4 0001 = 1:2 0000 = 1:1 register 30-8: fwdt configuration register (continued) downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 397 pic24fj1024ga610/gb610 family register 30-9: fpor co nfiguration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 23 bit 16 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 15 bit 8 u-1 u-1 u-1 u-1 r/po-1 r/po-1 r/po-1 r/po-1 dnvpen lpcfg boren1 boren0 bit 7 bit 0 legend: po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-4 unimplemented: read as 1 bit 3 dnvpen: downside voltage protection enable bit 1 = downside protection is enabled when bor is inactive; por can be re-armed as needed (can result in extra por monitoring current once por is re-armed) 0 = downside protection is disabled when bor is inactive bit 2 lpcfg : low-power regulator control bit 1 = retention feature is not available 0 = retention feature is available and controlled by reten during sleep bit 1-0 boren<1:0>: brown-out reset enable bits 11 = brown-out reset is enabled in hardware; sboren bit is disabled 10 = brown-out reset is enabled only while device is active and is disabled in sleep; sboren bit is disabled 01 = brown-out reset is controlled with the sboren bit setting 00 = brown-out reset is disabled in hardware; sboren bit is disabled downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 398 ? 2015 microchip technology inc. register 30-10: ficd configuration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 23 bit 16 r/po-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 btswp bit 15 bit 8 r-1 u-1 r/po-1 u-1 u-1 u-1 r/po-1 r/po-1 j t a g e n ics1 ics0 bit 7 bit 0 legend: po = program once bit r = reserved bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-16 unimplemented: read as 1 bit 15 btswp: bootswp instruction enable bit 1 = bootswp instruction is disabled 0 = bootswp instruction is enabled bit 14-8 unimplemented: read as 1 bit 7 reserved: maintain as 1 bit 6 unimplemented: read as 1 bit 5 jtagen: jtag port enable bit 1 = jtag port is enabled 0 = jtag port is disabled bit 4-2 unimplemented: read as 1 bit 1-0 ics<1:0>: icd communication channel select bits 11 = communicates on pgec1/pged1 10 = communicates on pgec2/pged2 01 = communicates on pgec3/pged3 00 = reserved; do not use downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 399 pic24fj1024ga610/gb610 family register 30-11: fdevopt1 configuration register u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 23 bit 16 u-1 u-1 u-1 u-1 u-1 u-1 u-1 u-1 bit 15 bit 8 u-1 u-1 u-1 r/po-1 r/po-1 r/po-1 r/po-1 u-1 altvref soschp ( 1 ) tmprpin altcmpi bit 7 bit 0 legend: po = program once bit r = readable bit w = writable bit u = unimplemented bit, read as 1 -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown bit 23-5 unimplemented: read as 1 bit 4 altvref: alternate voltage reference location enable bit (100-pin and 121-pin devices only) 1 = v ref + and cv ref + on ra10, v ref - and cv ref - on ra9 0 = v ref + and cv ref + on rb0, v ref - and cv ref - on rb1 bit 3 soschp: sosc high-power enable bit (valid only when soscsel = 1 ) ( 1 ) 1 = sosc high-power mode is enabled 0 = sosc low-power mode is enabled bit 2 tmprpin: tamper pin enable bit 1 = tmpr pin function is disabled 0 = tmpr pin function is enabled bit 1 altcmpi: alternate comparator input enable bit 1 = c1inc, c2inc and c3inc are on their standard pin locations 0 = c1inc, c2inc and c3inc are on rg9 bit 0 unimplemented: read as 1 note 1: high-power mode is for crystals with 35k esr (typical). low-power mode is for crystals with more than 65k esr. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 400 ? 2015 microchip technology inc. table 30-2: device id registers table 30-3: device id bit field descriptions table 30-4: pic24fj1024ga610/gb610 family device ids 30.2 unique device identifier (udid) all pic24fj1024ga610/gb610 family devices are individually encoded during final manufacturing with a unique device identifier, or udid. the udid cannot be erased by a bulk erase command or any other user- accessible means. this feature allows for manufacturing traceability of microchip technology devices in applica- tions where this is a requirement. it may also be used by the application manufacturer for any number of things that may require unique identification, such as: tracking the device unique serial number unique security key the udid comprises five 24-bit program words. when taken together, these fields form a unique 120-bit identifier. the udid is stored in five read-only locations, located between 801600h and 801608h in the device configu- ration space. tab l e 3 0- 5 lists the addresses of the identifier words. address name bit 1 51 41 31 21 11 09876543210 ff0000h devid famid<7:0> dev<7:0> ff0002h devrev rev<3:0> bit field register description famid<7:0> devid encodes the family id of the device. dev<7:0> devid encodes the individual id of the device. rev<3:0> devrev encodes the sequential (numerical) revision identifier of the device. device devid pic24fj128ga606 6000h pic24fj256ga606 6008h pic24fj512ga606 6010h pic24fj1024ga606 6018h pic24fj128ga610 6001h pic24fj256ga610 6009h pic24fj512ga610 6011h pic24fj1024ga610 6019h pic24fj128gb606 6004h pic24fj256gb606 600ch pic24fj512gb606 6014h pic24fj1024gb606 601ch pic24fj128gb610 6005h pic24fj256gb610 600dh pic24fj512gb610 6015h pic24fj1024gb610 601dh table 30-5: udid addresses udid address description udid1 801600 udid word 1 udid2 801602 udid word 2 udid3 801604 udid word 3 udid4 801606 udid word 4 udid5 801608 udid word 5 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 401 pic24fj1024ga610/gb610 family 30.3 on-chip voltage regulator all pic24fj1024ga610/gb610 family devices power their core digital logic at a nominal 1.8v. this may create an issue for designs that are required to operate at a higher typical voltage, such as 3.3v. to simplify system design, all devices in the pic24fj1024ga610/ gb610 family incorporate an on-chip regulator that allows the device to run its core logic from v dd . this regulator is always enabled. it provides a constant voltage (1.8v nominal) to the digital core logic, from a v dd of about 2.1v, all the way up to the devices v ddmax . it does not have the capability to boost v dd levels. in order to prevent brown-out conditions when the voltage drops too low for the regulator, the brown- out reset occurs. then, the regulator output follows v dd with a typical voltage drop of 300 mv. a low-esr capacitor (such as ceramic) must be connected to the v cap pin ( figure 30-1 ). this helps to maintain the stability of the regulator. the recommended value for the filter capacitor (c efc ) is provided in section 33.1 dc characteristics . figure 30-1: connections for the on-chip regulator 30.3.1 on-chip regulator and por the voltage regulator takes approximately 10 ? s for it to generate output. during this time, designated as t vreg , code execution is disabled. t vreg is applied every time the device resumes operation after any power-down, including sleep mode. t vreg is deter- mined by the status of the vregs bit (rcon<8>) and the wdtwin<1:0> configuration bits (fwdt<9:8>). refer to section 33.0 electrical characteristics for more information on t vreg . 30.3.2 voltage regulator standby mode the on-chip regulator always consumes a small incre- mental amount of current over i dd /i pd , including when the device is in sleep mode, even though the core digital logic does not require power. to provide addi- tional savings in applications where power resources are critical, the regulator can be made to enter standby mode on its own whenever the device goes into sleep mode. this feature is controlled by the vregs bit (rcon<8>). clearing the vregs bit enables the standby mode. when waking up from standby mode, the regulator needs to wait for t vreg to expire before wake-up. 30.3.3 low-voltage/retention regulator when in sleep mode, pic24fj1024ga610/gb610 family devices may use a separate low-power, low- voltage/retention regulator to power critical circuits. this regulator, which operates at 1.2v nominal, main- tains power to data ram and the rtcc while all other core digital logic is powered down. the low-voltage/ retention regulator is described in more detail in section 10.2.4 low-voltage/retention regulator . v dd v cap v ss pic24fjxxxgx6xx c efc 3.3v (1) note 1: this is a typical operating voltage. refer to section 33.0 electrical characteristics for the full operating ranges of v dd . (10 ? f typ) note: for more information, see section 33.0 electrical characteristics . the infor- mation in this data sheet supersedes the information in the frm. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 402 ? 2015 microchip technology inc. 30.4 watchdog timer (wdt) for pic24fj1024ga610/gb610 family devices, the wdt is driven by the lprc oscillator, the secondary oscillator (sosc) or the system timer. when the device is in sleep mode, the lprc oscillator will be used. when the wdt is enabled, the clock source is also enabled. the nominal wdt clock source from lprc is 31 khz. this feeds a prescaler that can be configured for either 5-bit (divide-by-32) or 7-bit (divide-by-128) operation. the prescaler is set by the fwpsa configuration bit. with a 31 khz input, the prescaler yields a nominal wdt time-out (t wdt ) period of 1 ms in 5-bit mode or 4 ms in 7-bit mode. a variable postscaler divides down the wdt prescaler output and allows for a wide range of time-out periods. the postscaler is controlled by the wdtps<3:0> con- figuration bits (fwdt<3:0>), which allows the selection of a total of 16 settings, from 1:1 to 1:32,768. using the prescaler and postscaler time-out periods, ranges from 1 ms to 131 seconds, can be achieved. the wdt, prescaler and postscaler are reset: on any device reset on the completion of a clock switch, whether invoked by software (i.e., setting the oswen bit after changing the noscx bits) or by hardware (i.e., fail-safe clock monitor) when a pwrsav instruction is executed (i.e., sleep or idle mode is entered) when the device exits sleep or idle mode to resume normal operation by a clrwdt instruction during normal execution if the wdt is enabled, it will continue to run during sleep or idle modes. when the wdt time-out occurs, the device will wake the device and code execution will continue from where the pwrsav instruction was executed. the corresponding sleep or idle (rcon<3:2>) bits will need to be cleared in software after the device wakes up. the wdt flag bit, wdto (rcon<4>), is not auto- matically cleared following a wdt time-out. to detect subsequent wdt events, the flag must be cleared in software. 30.4.1 windowed operation the watchdog timer has an optional fixed window mode of operation. in this windowed mode, clrwdt instructions can only reset the wdt during the last 1/4 of the programmed wdt period. a clrwdt instruction executed before that window causes a wdt reset, similar to a wdt time-out. windowed wdt mode is enabled by programming the windis configuration bit (fwdt<7>) to 0 . 30.4.2 control register the wdt is enabled or disabled by the fwdten<1:0> configuration bits (fwdt<6:5>). when the configura- tion bits, fwdten<1:0> = 11 , the wdt is always enabled. the wdt can be optionally controlled in software when the configuration bits, fwdten<1:0> = 10 . when fwdten<1:0> = 00 , the watchdog timer is always disabled. the wdt is enabled in software by setting the swdten control bit (rcon<5>). the swdten control bit is cleared on any device reset. the software wdt option allows the user to enable the wdt for critical code segments and disable the wdt during non-critical code segments for maximum power savings. note: the clrwdt and pwrsav instructions clear the prescaler and postscaler counts when executed. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 403 pic24fj1024ga610/gb610 family figure 30-2: wdt block diagram wdt overflow wake from 31 khz prescaler postscaler fwpsa swdten fwdten<1:0> reset sleep or idle mode lprc control (5-bit/7-bit) 1:1 to 1:32.768 wdtps<3:0> 1 ms/4 ms wdt counter sosc frc peripheral clock wdtclks<1:0> lprc windis system clock (lrpc) sleep clrwdt instr. pwrsav instr. all device resets transition to new clock source exit sleep or idle mode downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 404 ? 2015 microchip technology inc. 30.5 program verification and code protection pic24fj1024ga610/gb610 family devices offer basic implementation of codeguard? security that supports general segment (gs) security and boot segment (bs) security. this feature helps protect individual intellectual property. 30.6 jtag interface pic24fj1024ga610/gb610 family devices implement a jtag interface, which supports boundary scan device testing. 30.7 in-circuit serial programming pic24fj1024ga610/gb610 family microcontrollers can be serially programmed while in the end applica- tion circuit. this is simply done with two lines for clock (pgecx) and data (pgedx), and three other lines for power (v dd ), ground (v ss ) and mclr . this allows customers to manufacture boards with unprogrammed devices and then program the microcontroller just before shipping the product. this also allows the most recent firmware or a custom firmware to be programmed. 30.8 customer otp memory pic24fj1024ga610/gb610 family devices provide 256 bytes of one-time-programmable (otp) memory, located at addresses, 801700h through 8017feh. this memory can be used for persistent storage of application-specific information that will not be erased by reprogramming the device. this includes many types of information, such as (but not limited to): application checksums code revision information product information serial numbers system manufacturing dates manufacturing lot numbers otp memory cannot be written by program execution (i.e., tblwt instructions); it can only be written during device programming. data is not cleared by a chip erase. 30.9 in-circuit debugger this function allows simple debugging functions when used with mplab ide. debugging functionality is con- trolled through the pgecx (emulation/debug clock) and pgedx (emulation/debug data) pins. to use the in-circuit debugger function of the device, the design must implement icsp? connections to mclr , v dd , v ss and the pgecx/pgedx pin pair, des- ignated by the ics<1:0> configuration bits. in addition, when the feature is enabled, some of the resources are not available for general use. these resources include the first 80 bytes of data ram and two i/o pins. note: for more information on usage, configura- tion and operation, refer to the dspic33/ pic24 family reference manual , codeguard? intermediate security (ds70005182). note: data in the otp memory section must not be programmed more than once. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 405 pic24fj1024ga610/gb610 family 31.0 development support the pic ? microcontrollers (mcu) and dspic ? digital signal controllers (dsc) are supported with a full range of software and hardware development tools: integrated development environment - mplab ? x ide software compilers/assemblers/linkers - mplab xc compiler - mpasm tm assembler -mplink tm object linker/ mplib tm object librarian - mplab assembler/linker/librarian for various device families simulators - mplab x sim software simulator emulators - mplab real ice? in-circuit emulator in-circuit debuggers/programmers - mplab icd 3 - pickit? 3 device programmers - mplab pm3 device programmer low-cost demonstration/development boards, evaluation kits and starter kits third-party development tools 31.1 mplab x integrated development environment software the mplab x ide is a single, unified graphical user interface for microchip and third-party software, and hardware development tool that runs on windows ? , linux and mac os ? x. based on the netbeans ide, mplab x ide is an entirely new ide with a host of free software components and plug-ins for high- performance application development and debugging. moving between tools and upgrading from software simulators to hardware debugging and programming tools is simple with the seamless user interface. with complete project management, visual call graphs, a configurable watch window and a feature-rich editor that includes code completion and context menus, mplab x ide is flexible and friendly enough for new users. with the ability to support multiple tools on multiple projects with simultaneous debugging, mplab x ide is also suitable for the needs of experienced users. feature-rich editor: color syntax highlighting smart code completion makes suggestions and provides hints as you type automatic code formatting based on user-defined rules live parsing user-friendly, customizable interface: fully customizable interface: toolbars, toolbar buttons, windows, window placement, etc. call graph window project-based workspaces: multiple projects multiple tools multiple configurations simultaneous debugging sessions file history and bug tracking: local file history feature built-in support for bugzilla issue tracker downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 406 ? 2015 microchip technology inc. 31.2 mplab xc compilers the mplab xc compilers are complete ansi c compilers for all of microchips 8, 16, and 32-bit mcu and dsc devices. these compilers provide powerful integration capabilities, superior code optimization and ease of use. mplab xc compilers run on windows, linux or mac os x. for easy source level debugging, the compilers provide debug information that is optimized to the mplab x ide. the free mplab xc compiler editions support all devices and commands, with no time or memory restrictions, and offer sufficient code optimization for most applications. mplab xc compilers include an assembler, linker and utilities. the assembler generates relocatable object files that can then be archived or linked with other relo- catable object files and archives to create an execut- able file. mplab xc compiler uses the assembler to produce its object file. notable features of the assem- bler include: support for the entire device instruction set support for fixed-point and floating-point data command-line interface rich directive set flexible macro language mplab x ide compatibility 31.3 mpasm assembler the mpasm assembler is a full-featured, universal macro assembler for pic10/12/16/18 mcus. the mpasm assembler generates relocatable object files for the mplink object linker, intel ? standard hex files, map files to detail memory usage and symbol reference, absolute lst files that contain source lines and generated machine code, and coff files for debugging. the mpasm assembler features include: integration into mplab x ide projects user-defined macros to streamline assembly code conditional assembly for multipurpose source files directives that allow complete control over the assembly process 31.4 mplink object linker/ mplib object librarian the mplink object linker combines relocatable objects created by the mpasm assembler. it can link relocatable objects from precompiled libraries, using directives from a linker script. the mplib object librarian manages the creation and modification of library files of precompiled code. when a routine from a library is called from a source file, only the modules that contain that routine will be linked in with the application. this allows large libraries to be used efficiently in many different applications. the object linker/library features include: efficient linking of single libraries instead of many smaller files enhanced code maintainability by grouping related modules together flexible creation of libraries with easy module listing, replacement, deletion and extraction 31.5 mplab assembler, linker and librarian for various device families mplab assembler produces relocatable machine code from symbolic assembly language for pic24, pic32 and dspic dsc devices. mplab xc compiler uses the assembler to produce its object file. the assembler generates relocatable object files that can then be archived or linked with other relocatable object files and archives to create an executable file. notable features of the assembler include: support for the entire device instruction set support for fixed-point and floating-point data command-line interface rich directive set flexible macro language mplab x ide compatibility downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 407 pic24fj1024ga610/gb610 family 31.6 mplab x sim software simulator the mplab x sim software simulator allows code development in a pc-hosted environment by simulat- ing the pic mcus and dspic dscs on an instruction level. on any given instruction, the data areas can be examined or modified and stimuli can be applied from a comprehensive stimulus controller. registers can be logged to files for further run-time analysis. the trace buffer and logic analyzer display extend the power of the simulator to record and track program execution, actions on i/o, most peripherals and internal registers. the mplab x sim software simulator fully supports symbolic debugging using the mplab xc compilers, and the mpasm and mplab assemblers. the soft- ware simulator offers the flexibility to develop and debug code outside of the hardware laboratory envi- ronment, making it an excellent, economical software development tool. 31.7 mplab real ice in-circuit emulator system the mplab real ice in-circuit emulator system is microchips next generation high-speed emulator for microchip flash dsc and mcu devices. it debugs and programs all 8, 16 and 32-bit mcu, and dsc devices with the easy-to-use, powerful graphical user interface of the mplab x ide. the emulator is connected to the design engineers pc using a high-speed usb 2.0 interface and is connected to the target with either a connector compatible with in-circuit debugger systems (rj-11) or with the new high-speed, noise tolerant, low- voltage differential signal (lvds) interconnection (cat5). the emulator is field upgradable through future firmware downloads in mplab x ide. mplab real ice offers significant advantages over competitive emulators including full-speed emulation, run-time variable watches, trace analysis, complex breakpoints, logic probes, a ruggedized probe interface and long (up to three meters) interconnection cables. 31.8 mplab icd 3 in-circuit debugger system the mplab icd 3 in-circuit debugger system is microchips most cost-effective, high-speed hardware debugger/programmer for microchip flash dsc and mcu devices. it debugs and programs pic flash microcontrollers and dspic dscs with the powerful, yet easy-to-use graphical user interface of the mplab ide. the mplab icd 3 in-circuit debugger probe is connected to the design engineers pc using a high- speed usb 2.0 interface and is connected to the target with a connector compatible with the mplab icd 2 or mplab real ice systems (rj-11). mplab icd 3 supports all mplab icd 2 headers. 31.9 pickit 3 in-circuit debugger/ programmer the mplab pickit 3 allows debugging and program- ming of pic and dspic flash microcontrollers at a most affordable price point using the powerful graphical user interface of the mplab ide. the mplab pickit 3 is connected to the design engineers pc using a full- speed usb interface and can be connected to the tar- get via a microchip debug (rj-11) connector (compati- ble with mplab icd 3 and mplab real ice). the connector uses two device i/o pins and the reset line to implement in-circuit debugging and in-circuit serial programming? (icsp?). 31.10 mplab pm3 device programmer the mplab pm3 device programmer is a universal, ce compliant device programmer with programmable voltage verification at v ddmin and v ddmax for maximum reliability. it features a large lcd display (128 x 64) for menus and error messages, and a mod- ular, detachable socket assembly to support various package types. the icsp cable assembly is included as a standard item. in stand-alone mode, the mplab pm3 device programmer can read, verify and program pic devices without a pc connection. it can also set code protection in this mode. the mplab pm3 connects to the host pc via an rs-232 or usb cable. the mplab pm3 has high-speed communications and optimized algorithms for quick programming of large memory devices, and incorporates an mmc card for file storage and data applications. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 408 ? 2015 microchip technology inc. 31.11 demonstration/development boards, evaluation kits, and starter kits a wide variety of demonstration, development and evaluation boards for various pic mcus and dspic dscs allows quick application development on fully functional systems. most boards include prototyping areas for adding custom circuitry and provide applica- tion firmware and source code for examination and modification. the boards support a variety of features, including leds, temperature sensors, switches, speakers, rs-232 interfaces, lcd displays, potentiometers and additional eeprom memory. the demonstration and development boards can be used in teaching environments, for prototyping custom circuits and for learning about various microcontroller applications. in addition to the picdem? and dspicdem? demonstration/development board series of circuits, microchip has a line of evaluation kits and demonstra- tion software for analog filter design, k ee l oq ? security ics, can, irda ? , powersmart battery management, seeval ? evaluation system, sigma-delta adc, flow rate sensing, plus many more. also available are starter kits that contain everything needed to experience the specified device. this usually includes a single application and debug capability, all on one board. check the microchip web page ( www.microchip.com ) for the complete list of demonstration, development and evaluation kits. 31.12 third-party development tools microchip also offers a great collection of tools from third-party vendors. these tools are carefully selected to offer good value and unique functionality. device programmers and gang programmers from companies, such as softlog and ccs software tools from companies, such as gimpel and trace systems protocol analyzers from companies, such as saleae and total phase demonstration boards from companies, such as mikroelektronika, digilent ? and olimex embedded ethernet solutions from companies, such as ez web lynx, wiznet and iplogika ? downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 409 pic24fj1024ga610/gb610 family 32.0 instruction set summary the pic24f instruction set adds many enhancements to the previous pic ? mcu instruction sets, while main- taining an easy migration from previous pic mcu instruction sets. most instructions are a single program memory word. only three instructions require two program memory locations. each single-word instruction is a 24-bit word divided into an 8-bit opcode, which specifies the instruction type and one or more operands, which further specify the operation of the instruction. the instruction set is highly orthogonal and is grouped into four basic categories: word or byte-oriented operations bit-oriented operations literal operations control operations table 32-1 shows the general symbols used in describing the instructions. the pic24f instruction set summary in table 32-2 lists all the instructions, along with the status flags affected by each instruction. most word or byte-oriented w register instructions (including barrel shift instructions) have three operands: the first source operand, which is typically a register, wb, without any address modifier the second source operand, which is typically a register, ws, with or without an address modifier the destination of the result, which is typically a register, wd, with or without an address modifier however, word or byte-oriented file register instructions have two operands: the file register specified by the value, f the destination, which could either be the file register, f, or the w0 register, which is denoted as wreg most bit-oriented instructions (including simple rotate/ shift instructions) have two operands: the w register (with or without an address modifier) or file register (specified by the value of ws or f) the bit in the w register or file register (specified by a literal value or indirectly by the contents of register, wb) the literal instructions that involve data movement may use some of the following operands: a literal value to be loaded into a w register or file register (specified by the value of k) the w register or file register where the literal value is to be loaded (specified by wb or f) however, literal instructions that involve arithmetic or logical operations use some of the following operands: the first source operand, which is a register, wb, without any address modifier the second source operand, which is a literal value the destination of the result (only if not the same as the first source operand), which is typically a register, wd, with or without an address modifier the control instructions may use some of the following operands: a program memory address the mode of the table read and table write instructions all instructions are a single word, except for certain double-word instructions, which were made double- word instructions so that all the required information is available in these 48 bits. in the second word, the 8msbs are 0 s. if this second word is executed as an instruction (by itself), it will execute as a nop . most single-word instructions are executed in a single instruction cycle, unless a conditional test is true or the program counter is changed as a result of the instruc- tion. in these cases, the execution takes two instruction cycles, with the additional instruction cycle(s) executed as a nop . notable exceptions are the bra (uncondi- tional/computed branch), indirect call/goto , all table reads and table writes, and return/retfie instructions, which are single-word instructions but take two or three cycles. certain instructions that involve skipping over the sub- sequent instruction require either two or three cycles if the skip is performed, depending on whether the instruction being skipped is a single-word or two-word instruction. moreover, double-word moves require two cycles. the double-word instructions execute in two instruction cycles. note: this chapter is a brief summary of the pic24f instruction set architecture (isa) and is not intended to be a comprehensive reference source. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 410 ? 2015 microchip technology inc. table 32-1: symbols used in opcode descriptions field description #text means literal defined by text (text) means content of text [text] means the location addressed by text { } optional field or operation register bit field .b byte mode selection .d double-word mode selection .s shadow register select .w word mode selection (default) bit4 4-bit bit selection field (used in word addressed instructions) ?? {0...15} c, dc, n, ov, z mcu status bits: carry, digit carry, negative, overflow, sticky zero expr absolute address, label or expression (resolved by the linker) f file register address ?? {0000h...1fffh} lit1 1-bit unsigned literal ?? {0,1} lit4 4-bit unsigned literal ?? {0...15} lit5 5-bit unsigned literal ?? {0...31} lit8 8-bit unsigned literal ?? {0...255} lit10 10-bit unsigned literal ?? {0...255} for byte mode, {0:1023} for word mode lit14 14-bit unsigned literal ?? {0...16383} lit16 16-bit unsigned literal ?? {0...65535} lit23 23-bit unsigned literal ?? {0...8388607}; lsb must be 0 none field does not require an entry, may be blank pc program counter slit10 10-bit signed literal ?? {-512...511} slit16 16-bit signed literal ?? {-32768...32767} slit6 6-bit signed literal ?? {-16...16} wb base w register ?? {w0..w15} wd destination w register ?? { wd, [wd], [wd++], [wd--], [++wd], [--wd] } wdo destination w register ?? { wnd, [wnd], [wnd++], [wnd--], [++wnd], [--wnd], [wnd+wb] } wm,wn dividend, divisor working register pair (direct addressing) wn one of 16 working registers ?? {w0..w15} wnd one of 16 destination working registers ?? {w0..w15} wns one of 16 source working registers ?? {w0..w15} wreg w0 (working register used in file register instructions) ws source w register ?? { ws, [ws], [ws++], [ws--], [++ws], [--ws] } wso source w register ?? { wns, [wns], [wns++], [wns--], [++wns], [--wns], [wns+wb] } downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 411 pic24fj1024ga610/gb610 family table 32-2: instruction set overview assembly mnemonic assembly syntax description # of words # of cycles status flags affected add add f f = f + wreg 1 1 c, dc, n, ov, z add f,wreg wreg = f + wreg 1 1 c, dc, n, ov, z add #lit10,wn wd = lit10 + wd 1 1 c, dc, n, ov, z add wb,ws,wd wd = wb + ws 1 1 c, dc, n, ov, z add wb,#lit5,wd wd = wb + lit5 1 1 c, dc, n, ov, z addc addc f f = f + wreg + (c) 1 1 c, dc, n, ov, z addc f,wreg wreg = f + wreg + (c) 1 1 c, dc, n, ov, z addc #lit10,wn wd = lit10 + wd + (c) 1 1 c, dc, n, ov, z addc wb,ws,wd wd = wb + ws + (c) 1 1 c, dc, n, ov, z addc wb,#lit5,wd wd = wb + lit5 + (c) 1 1 c, dc, n, ov, z and and f f = f .and. wreg 1 1 n, z and f,wreg wreg = f .and. wreg 1 1 n, z and #lit10,wn wd = lit10 .and. wd 1 1 n, z and wb,ws,wd wd = wb .and. ws 1 1 n, z and wb,#lit5,wd wd = wb .and. lit5 1 1 n, z asr asr f f = arithmetic right shift f 1 1 c, n, ov, z asr f,wreg wreg = arithmetic right shift f 1 1 c, n, ov, z asr ws,wd wd = arithmetic right shift ws 1 1 c, n, ov, z asr wb,wns,wnd wnd = arithmetic right shift wb by wns 1 1 n, z asr wb,#lit5,wnd wnd = arithmetic right shift wb by lit5 1 1 n, z bclr bclr f,#bit4 bit clear f 1 1 none bclr ws,#bit4 bit clear ws 1 1 none bra bra c,expr branch if carry 1 1 (2) none bra ge,expr branch if greater than or equal 1 1 (2) none bra geu,expr branch if unsigned greater than or equal 1 1 (2) none bra gt,expr branch if greater than 1 1 (2) none bra gtu,expr branch if unsigned greater than 1 1 (2) none bra le,expr branch if less than or equal 1 1 (2) none bra leu,expr branch if unsigned less than or equal 1 1 (2) none bra lt,expr branch if less than 1 1 (2) none bra ltu,expr branch if unsigned less than 1 1 (2) none bra n,expr branch if negative 1 1 (2) none bra nc,expr branch if not carry 1 1 (2) none bra nn,expr branch if not negative 1 1 (2) none bra nov,expr branch if not overflow 1 1 (2) none bra nz,expr branch if not zero 1 1 (2) none bra ov,expr branch if overflow 1 1 (2) none bra expr branch unconditionally 1 2 none bra z,expr branch if zero 1 1 (2) none bra wn computed branch 1 2 none bset bset f,#bit4 bit set f 1 1 none bset ws,#bit4 bit set ws 1 1 none bsw bsw.c ws,wb write c bit to ws 1 1 none bsw.z ws,wb write z bit to ws 1 1 none btg btg f,#bit4 bit toggle f 1 1 none btg ws,#bit4 bit toggle ws 1 1 none btsc btsc f,#bit4 bit test f, skip if clear 1 1 (2 or 3) none btsc ws,#bit4 bit test ws, skip if clear 1 1 (2 or 3) none downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 412 ? 2015 microchip technology inc. btss btss f,#bit4 bit test f, skip if set 1 1 (2 or 3) none btss ws,#bit4 bit test ws, skip if set 1 1 (2 or 3) none btst btst f,#bit4 bit test f 1 1 z btst.c ws,#bit4 bit test ws to c 1 1 c btst.z ws,#bit4 bit test ws to z 1 1 z btst.c ws,wb bit test ws to c 1 1 c btst.z ws,wb bit test ws to z 1 1 z btsts btsts f,#bit4 bit test then set f 1 1 z btsts.c ws,#bit4 bit test ws to c, then set 1 1 c btsts.z ws,#bit4 bit test ws to z, then set 1 1 z call call lit23 call subroutine 2 2 none call wn call indirect subroutine 1 2 none clr clr f f = 0x0000 1 1 none clr wreg wreg = 0x0000 1 1 none clr ws ws = 0x0000 1 1 none clrwdt clrwdt clear watchdog timer 1 1 wdto, sleep com com f f = f 11n , z com f,wreg wreg = f 11n , z com ws,wd wd = ws 11n , z cp cp f compare f with wreg 1 1 c, dc, n, ov, z cp wb,#lit5 compare wb with lit5 1 1 c, dc, n, ov, z cp wb,ws compare wb with ws (wb C ws) 1 1 c, dc, n, ov, z cp0 cp0 f compare f with 0x0000 1 1 c, dc, n, ov, z cp0 ws compare ws with 0x0000 1 1 c, dc, n, ov, z cpb cpb f compare f with wreg, with borrow 1 1 c, dc, n, ov, z cpb wb,#lit5 compare wb with lit5, with borrow 1 1 c, dc, n, ov, z cpb wb,ws compare wb with ws, with borrow (wb C ws C c ) 1 1 c, dc, n, ov, z cpseq cpseq wb,wn compare wb with wn, skip if = 1 1 (2 or 3) none cpsgt cpsgt wb,wn compare wb with wn, skip if > 1 1 (2 or 3) none cpslt cpslt wb,wn compare wb with wn, skip if < 1 1 (2 or 3) none cpsne cpsne wb,wn compare wb with wn, skip if ? 11 (2 or 3) none daw daw.b wn wn = decimal adjust wn 1 1 c dec dec f f = f C1 1 1 c, dc, n, ov, z dec f,wreg wreg = f C1 1 1 c, dc, n, ov, z dec ws,wd wd = ws C 1 1 1 c, dc, n, ov, z dec2 dec2 f f = f C 2 1 1 c, dc, n, ov, z dec2 f,wreg wreg = f C 2 1 1 c, dc, n, ov, z dec2 ws,wd wd = ws C 2 1 1 c, dc, n, ov, z disi disi #lit14 disable interrupts for k instruction cycles 1 1 none div div.sw wm,wn signed 16/16-bit integer divide 1 18 n, z, c, ov div.sd wm,wn signed 32/16-bit integer divide 1 18 n, z, c, ov div.uw wm,wn unsigned 16/16-bit integer divide 1 18 n, z, c, ov div.ud wm,wn unsigned 32/16-bit integer divide 1 18 n, z, c, ov exch exch wns,wnd swap wns with wnd 1 1 none ff1l ff1l ws,wnd find first one from left (msb) side 1 1 c ff1r ff1r ws,wnd find first one from right (lsb) side 1 1 c table 32-2: instruction set overview (continued) assembly mnemonic assembly syntax description # of words # of cycles status flags affected downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 413 pic24fj1024ga610/gb610 family goto goto expr go to address 2 2 none goto wn go to indirect 1 2 none inc inc f f = f + 1 1 1 c, dc, n, ov, z inc f,wreg wreg = f + 1 1 1 c, dc, n, ov, z inc ws,wd wd = ws + 1 1 1 c, dc, n, ov, z inc2 inc2 f f = f + 2 1 1 c, dc, n, ov, z inc2 f,wreg wreg = f + 2 1 1 c, dc, n, ov, z inc2 ws,wd wd = ws + 2 1 1 c, dc, n, ov, z ior ior f f = f .ior. wreg 1 1 n, z ior f,wreg wreg = f .ior. wreg 1 1 n, z ior #lit10,wn wd = lit10 .ior. wd 1 1 n, z ior wb,ws,wd wd = wb .ior. ws 1 1 n, z ior wb,#lit5,wd wd = wb .ior. lit5 1 1 n, z lnk lnk #lit14 link frame pointer 1 1 none lsr lsr f f = logical right shift f 1 1 c, n, ov, z lsr f,wreg wreg = logical right shift f 1 1 c, n, ov, z lsr ws,wd wd = logical right shift ws 1 1 c, n, ov, z lsr wb,wns,wnd wnd = logical right shift wb by wns 1 1 n, z lsr wb,#lit5,wnd wnd = logical right shift wb by lit5 1 1 n, z mov mov f,wn move f to wn 1 1 none mov [wns+slit10],wnd move [wns+slit10] to wnd 1 1 none mov f move f to f 1 1 n, z mov f,wreg move f to wreg 1 1 n, z mov #lit16,wn move 16-bit literal to wn 1 1 none mov.b #lit8,wn move 8-bit literal to wn 1 1 none mov wn,f move wn to f 1 1 none mov wns,[wns+slit10] move wns to [wns+slit10] 1 1 none mov wso,wdo move ws to wd 1 1 none mov wreg,f move wreg to f 1 1 n, z mov.d wns,wd move double from w(ns):w(ns+1) to wd 1 2 none mov.d ws,wnd move double from ws to w(nd+1):w(nd) 1 2 none mul mul.ss wb,ws,wnd {wnd+1, wnd} = signed(wb) * signed(ws) 1 1 none mul.su wb,ws,wnd {wnd+1, wnd} = signed(wb) * unsigned(ws) 1 1 none mul.us wb,ws,wnd {wnd+1, wnd} = unsigned(wb) * signed(ws) 1 1 none mul.uu wb,ws,wnd {wnd+1, wnd} = unsigned(wb) * unsigned(ws) 1 1 none mul.su wb,#lit5,wnd {wnd+1, wnd} = signed(wb) * unsigned(lit5) 1 1 none mul.uu wb,#lit5,wnd {wnd+1, wnd} = unsigned(wb) * unsigned(lit5) 1 1 none mul f w3:w2 = f * wreg 1 1 none neg neg f f = f + 1 1 1 c, dc, n, ov, z neg f,wreg wreg = f + 1 1 1 c, dc, n, ov, z neg ws,wd wd = ws + 1 1 1 c, dc, n, ov, z nop nop no operation 1 1 none nopr no operation 1 1 none pop pop f pop f from top-of-stack (tos) 1 1 none pop wdo pop from top-of-stack (tos) to wdo 1 1 none pop.d wnd pop from top-of-stack (tos) to w(nd):w(nd+1) 1 2 none pop.s pop shadow registers 1 1 all push push f push f to top-of-stack (tos) 1 1 none push wso push wso to top-of-stack (tos) 1 1 none push.d wns push w(ns):w(ns+1) to top-of-stack (tos) 1 2 none push.s push shadow registers 1 1 none table 32-2: instruction set overview (continued) assembly mnemonic assembly syntax description # of words # of cycles status flags affected downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 414 ? 2015 microchip technology inc. pwrsav pwrsav #lit1 go into sleep or idle mode 1 1 wdto, sleep rcall rcall expr relative call 1 2 none rcall wn computed call 1 2 none repeat repeat #lit14 repeat next instruction lit14 + 1 times 1 1 none repeat wn repeat next instruction (wn) + 1 times 1 1 none reset reset software device reset 1 1 none retfie retfie return from interrupt 1 3 (2) none retlw retlw #lit10,wn return with literal in wn 1 3 (2) none return return return from subroutine 1 3 (2) none rlc rlc f f = rotate left through carry f 1 1 c, n, z rlc f,wreg wreg = rotate left through carry f 1 1 c, n, z rlc ws,wd wd = rotate left through carry ws 1 1 c, n, z rlnc rlnc f f = rotate left (no carry) f 1 1 n, z rlnc f,wreg wreg = rotate left (no carry) f 1 1 n, z rlnc ws,wd wd = rotate left (no carry) ws 1 1 n, z rrc rrc f f = rotate right through carry f 1 1 c, n, z rrc f,wreg wreg = rotate right through carry f 1 1 c, n, z rrc ws,wd wd = rotate right through carry ws 1 1 c, n, z rrnc rrnc f f = rotate right (no carry) f 1 1 n, z rrnc f,wreg wreg = rotate right (no carry) f 1 1 n, z rrnc ws,wd wd = rotate right (no carry) ws 1 1 n, z se se ws,wnd wnd = sign-extended ws 1 1 c, n, z setm setm f f = ffffh 1 1 none setm wreg wreg = ffffh 1 1 none setm ws ws = ffffh 1 1 none sl sl f f = left shift f 1 1 c, n, ov, z sl f,wreg wreg = left shift f 1 1 c, n, ov, z sl ws,wd wd = left shift ws 1 1 c, n, ov, z sl wb,wns,wnd wnd = left shift wb by wns 1 1 n, z sl wb,#lit5,wnd wnd = left shift wb by lit5 1 1 n, z sub sub f f = f C wreg 1 1 c, dc, n, ov, z sub f,wreg wreg = f C wreg 1 1 c, dc, n, ov, z sub #lit10,wn wn = wn C lit10 1 1 c, dc, n, ov, z sub wb,ws,wd wd = wb C ws 1 1 c, dc, n, ov, z sub wb,#lit5,wd wd = wb C lit5 1 1 c, dc, n, ov, z subb subb f f = f C wreg C (c ) 1 1 c, dc, n, ov, z subb f,wreg wreg = f C wreg C (c ) 1 1 c, dc, n, ov, z subb #lit10,wn wn = wn C lit10 C (c ) 1 1 c, dc, n, ov, z subb wb,ws,wd wd = wb C ws C (c ) 1 1 c, dc, n, ov, z subb wb,#lit5,wd wd = wb C lit5 C (c ) 1 1 c, dc, n, ov, z subr subr f f = wreg C f 1 1 c, dc, n, ov, z subr f,wreg wreg = wreg C f 1 1 c, dc, n, ov, z subr wb,ws,wd wd = ws C wb 1 1 c, dc, n, ov, z subr wb,#lit5,wd wd = lit5 C wb 1 1 c, dc, n, ov, z subbr subbr f f = wreg C f C (c ) 1 1 c, dc, n, ov, z subbr f,wreg wreg = wreg C f C (c ) 1 1 c, dc, n, ov, z subbr wb,ws,wd wd = ws C wb C (c ) 1 1 c, dc, n, ov, z subbr wb,#lit5,wd wd = lit5 C wb C (c ) 1 1 c, dc, n, ov, z swap swap.b wn wn = nibble swap wn 1 1 none swap wn wn = byte swap wn 1 1 none table 32-2: instruction set overview (continued) assembly mnemonic assembly syntax description # of words # of cycles status flags affected downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 415 pic24fj1024ga610/gb610 family tblrdh tblrdh ws,wd read prog<23:16> to wd<7:0> 1 2 none tblrdl tblrdl ws,wd read prog<15:0> to wd 1 2 none tblwth tblwth ws,wd write ws<7:0> to prog<23:16> 1 2 none tblwtl tblwtl ws,wd write ws to prog<15:0> 1 2 none ulnk ulnk unlink frame pointer 1 1 none xor xor f f = f .xor. wreg 1 1 n, z xor f,wreg wreg = f .xor. wreg 1 1 n, z xor #lit10,wn wd = lit10 .xor. wd 1 1 n, z xor wb,ws,wd wd = wb .xor. ws 1 1 n, z xor wb,#lit5,wd wd = wb .xor. lit5 1 1 n, z ze ze ws,wnd wnd = zero-extend ws 1 1 c, z, n table 32-2: instruction set overview (continued) assembly mnemonic assembly syntax description # of words # of cycles status flags affected downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 416 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 417 pic24fj1024ga610/gb610 family 33.0 electrical characteristics this section provides an overview of the pic24fj1024ga610/gb610 family electrical characteristics. additi onal information will be provided in future revisions of this document as it becomes available. absolute maximum ratings for the pic24fj1024ga610/gb610 family are listed below. exposure to these maximum rating conditions for extended periods may affect device reliability. functional operation of the device at these, or any other conditions above the parameters indicated in the operation listings of this specification, is not implied. absolute maximum ratings ( ? ) ambient temperature under bias................................................................................................. ............. .-40c to +85c storage temperature ............................................................................................................ .................. -65c to +150c voltage on v dd with respect to v ss ......................................................................................................... -0.3v to +4.0v voltage on any general purpose digital or analog pin (not 5.5v tolerant) with respect to v ss ....... -0.3v to (v dd + 0.3v) voltage on any general purpose digital or analog pin (5.5v tolerant, including mclr ) with respect to v ss : when v dd = 0v: ......................................................................................................................... . -0.3v to +4.0v when v dd ? 2.0v: ....................................................................................................................... -0 .3v to +6.0v voltage on av dd with respect to v ss ................................................... (v dd C 0.3v) to (lesser of: 4.0v or (v dd + 0.3v)) voltage on av ss with respect to v ss ........................................................................................................ -0.3v to +0.3v maximum current out of v ss pin ........................................................................................................................... 300 ma maximum current into v dd pin ( note 1 ) ................................................................................................................250 ma maximum output current sunk by any i/o pin .................................................................................... .....................25 ma maximum output current sourced by any i/o pin ....................................................................................................25 ma maximum current sunk by all ports .......................................................................................................................200 ma maximum current sourced by all ports ( note 1 ) ....................................................................................................200 ma note 1: maximum allowable current is a function of device maximum power dissipation (see tab l e 3 3- 1 ). ? notice: stresses above those listed under absolute maximum ratings may cause permanent damage to the device. this is a stress rating only and functional operat ion of the device at those or any other conditions above those indicated in the operation listings of this specification is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 418 ? 2015 microchip technology inc. 33.1 dc characteristics figure 33-1: pic24fj1024ga610/gb610 family voltage-frequency graph (industrial) table 33-1: thermal operating conditions rating symbol min typ max unit pic24fj1024ga610/gb610: operating junction temperature range t j -40 +85 c operating ambient temperature range t a -40 +85 c power dissipation: internal chip power dissipation: p int = v dd x (i dd C ? i oh ) p d p int + p i / o w i/o pin power dissipation: p i / o = ? ({v dd C v oh } x i oh ) + ? (v ol x i ol ) maximum allowed power dissipation p dmax (t j C t a )/ ? ja w frequency voltage (v dd ) (note 1) 32 mhz 3.6v 3.6v (note 1) note 1: lower operating boundary is 2.0v or v bor (when bor is enabled), whichever is lower. for best analog performance, operation above 2.2v is suggested but not required. pic24fj1024ga610/gb610 table 33-2: thermal packaging characteristics characteristic symbol typ max unit notes package thermal resistance, 9x9x0.9 mm qfn ? ja 33.7 c/w ( note 1 ) package thermal resistance, 10x10x1 mm tqfp ? ja 28 c/w ( note 1 ) package thermal resistance, 12x12x1 mm tqfp ? ja 39.3 c/w ( note 1 ) package thermal resistance, 10x10x1.1 mm tfbga ? ja 40.2 c/w ( note 1 ) note 1: junction to ambient thermal resistance; theta- ja ( ? ja ) numbers are achieved by package simulations. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 419 pic24fj1024ga610/gb610 family table 33-3: dc characteristics: temperature and voltage specifications dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ max units conditions operating voltage dc10 v dd supply voltage 2.0 3.6 v bor is disabled v bor 3.6 v bor is enabled dc12 v dr ram data retention voltage ( 1 ) greater of: v porrel or v bor vv bor is used only if bor is enabled (boren = 1 ) dc16 v por v dd start voltage to ensure internal power-on reset signal v ss v ( note 2 ) dc17a sv dd recommended v dd rise rate to ensure internal power-on reset signal 1v/20 ms 1v/10 s sec ( note 2 , note 4 ) dc17b v bor brown-out reset voltage on v dd transition, high-to-low 2.0 2.1 2.2 v ( note 3 ) note 1: this is the limit to which v dd may be lowered and the ram contents will always be retained. 2: if the v por or sv dd parameters are not met, or the application experiences slow power-down v dd ramp rates, it is recommended to enable and use bor. 3: on a rising v dd power-up sequence, application firmware execution begins at the higher of the v porrel or v bor level (when boren = 1 ). 4: v dd rise times outside this window may not internally reset the processor and are not parametrically tested. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 420 ? 2015 microchip technology inc. table 33-4: dc characteristics: operating current (i dd ) dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial parameter no. typical ( 1 ) max units operating temperature v dd conditions operating current (i dd ) ( 2 ) dc19 230 365 ? a -40c to +85c 2.0v 0.5 mips, f osc = 1 mhz 250 365 ? a -40c to +85c 3.3v dc20 430 640 ? a -40c to +85c 2.0v 1 mips, f osc = 2 mhz 440 640 ? a -40c to +85c 3.3v dc23 1.5 2.4 ma -40c to +85c 2.0v 4 mips, f osc = 8 mhz 1.65 2.4 ma -40c to +85c 3.3v dc24 6.1 7.7 ma -40c to +85c 2.0v 16 mips,f osc = 32 mhz 6.3 7.7 ma -40c to +85c 3.3v dc31 43 100 ? a -40c to +85c 2.0v lprc (15.5 kips), f osc = 31 khz 46 100 ? a -40c to +85c 3.3v dc32 1.63 2.5 ma -40c to +85c 2.0v frc (8 mhz), f osc = 4 mhz 1.65 2.5 ma -40c to +85c 3.3v dc33 5.80 7.4 ma -40c to +85c 2.0v dco (8 mhz) f osc = 4 mhz 5.90 7.4 ma -40c to +85c 3.3v note 1: data in the typical column is at 3.3v, +25c unless otherwise stated. typical parameters are for desi gn guidance only and are not tested. 2: the test conditions for all i dd measurements are as follows: osc1 driven with external square wave from rail-to-rail. all i/o pins are configured as inputs and pulled to v ss . mclr = v dd ; wdt and fscm are dis- abled. cpu, program memory and data memory are operational. all peripheral modules are clocked but inactive (pmdx bits are all 1 ). table 33-5: dc characteristics: idle current (i idle ) dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial parameter no. typical ( 1 ) max units operating temperature v dd conditions idle current (i idle ) ( 2 ) dc40 95 400 ? a -40c to +85c 2.0v 1 mips, f osc = 2 mhz 105 400 ? a -40c to +85c 3.3v dc43 290 1200 ? a -40c to +85c 2.0v 4 mips, f osc = 8 mhz 315 1200 ? a -40c to +85c 3.3v dc47 1.05 3.7 ma -40c to +85c 2.0v 16 mips, f osc = 32 mhz 1.16 3.7 ma -40c to +85c 3.3v dc50 350 1100 ? a -40c to +85c 2.0v frc (8 mhz), f osc = 4 mhz 360 1100 ? a -40c to +85c 3.3v dc51 29 76 ? a -40c to +85c 2.0v lprc (15.5 kips), f osc = 31 khz 33 76 ? a -40c to +85c 3.3v note 1: data in the typical column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. 2: base i idle current is measured with the core off, the clock on and all modules turned off. peripheral module disable sfr registers are 1 . all i/o pins are configured as inputs and pulled to v ss . downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 421 pic24fj1024ga610/gb610 family table 33-6: dc characteristics: power-down current (i pd ) dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial parameter no. typical ( 1 ) max units operating temperature v dd conditions power-down current ( 4 , 5 ) dc60 2.5 10 ? a- 4 0 c 2.0v sleep ( 2 ) 3.2 10 ? a +25c 11.5 45 ? a +85c 3.2 10 ? a- 4 0 c 3.3v 4.0 10 ? a +25c 12.2 45 ? a +85c dc61 165 na -40c 2.0v low-voltage retention sleep ( 3 ) 190 na +25c 14.5 ? a +85c 220 na -40c 3.3v 300 na +25c 15 ? a +85c note 1: data in the typical column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. 2: the retention low-voltage regulator is disabled; reten (rcon<12>) = 0 , lpcfg (fpor<2>) = 1 . 3: the retention low-voltage regulator is enabled; reten (rcon<12>) = 1 , lpcfg (fpor<2>) = 0 . 4: base i pd is measured with all peripherals and clocks shut down. all i/os are configured as inputs and pulled to v ss . wdt, etc., are all switched off. 5: these currents are measured on the device containing the most memory in this family. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 422 ? 2015 microchip technology inc. table 33-7: dc characteristics: ? ? current (bor, wdt, hlvd, rtcc) ( 3 ) dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial parameter no. typical ( 1 ) max units operating temperature v dd conditions incremental current brown-out reset ( ? bor) ( 2 ) dc25 3 5 ? a -40c to +85c 2.0v ? bor ( 2 ) 45 ? a -40c to +85c 3.3v incremental current watchdog timer ( ? wdt) ( 2 ) dc71 0.22 1 ? a -40c to +85c 2.0v ? wdt ( 2 ) 0.3 1 ? a -40c to +85c 3.3v incremental current high/low-voltage detect ( ? hlvd) ( 2 ) dc75 1.3 5 ? a -40c to +85c 2.0v ? hlvd ( 2 ) 1.9 5 ? a -40c to +85c 3.3v incremental current real-time clock and calendar ( ? rtcc) ( 2 ) dc77 0.3 1 ? a -40c to +85c 2.0v ? rtcc (with sosc) ( 2 ) 0.35 1 ? a -40c to +85c 3.3v dc77a 0.3 1 ? a -40c to +85c 2.0v ? rtcc (with lprc) ( 2 ) 0.35 1 ? a -40c to +85c 3.3v note 1: data in the typical column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. 2: incremental current while the module is enabled and running. 3: the ? current is the additional current consumed when the module is enabled. this current should be added to the base i pd current. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 423 pic24fj1024ga610/gb610 family table 33-8: dc characteristics: i/o pin input specifications dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ ( 1 ) max units conditions v il input low voltage ( 3 ) di10 i/o pins with st buffer v ss 0.2 v dd v di11 i/o pins with ttl buffer v ss 0 . 1 5 v dd v di15 mclr v ss 0.2 v dd v di16 osci (xt mode) v ss 0.2 v dd v di17 osci (hs mode) v ss 0.2 v dd v di18 i/o pins with i 2 c buffer v ss 0.3 v dd v di19 i/o pins with smbus buffer v ss 0.8 v smbus is enabled v ih input high voltage ( 3 ) di20 i/o pins with st buffer: with analog functions, digital only 0.8 v dd 0.8 v dd v dd 5.5 vv di21 i/o pins with ttl buffer: with analog functions, digital only 0.25 v dd + 0.8 0.25 v dd + 0.8 v dd 5.5 vv di25 mclr 0.8 v dd v dd v di26 osci (xt mode) 0.7 v dd v dd v di27 osci (hs mode) 0.7 v dd v dd v di28 i/o pins with i 2 c buffer: with analog functions, digital only 0.7 v dd 0.7 v dd v dd 5.5 vv di29 i/o pins with smbus buffer: with analog functions, digital only 2.12.1 v dd 5.5 vv 2.5v ? v pin ? v dd di30 i cnpu cnx pull-up current 150 450 ? av dd = 3.3v, v pin = v ss di30a i cnpd cnx pull-down current 230 500 ? av dd = 3.3v, v pin = v dd i il input leakage current ( 2 ) di50 i/o ports 1 ? av ss ? v pin ? v dd , pin at high-impedance di51 analog input pins 1 ? av ss ? v pin ? v dd , pin at high-impedance di55 mclr 1 ? av ss ?? v pin ?? v dd di56 osci/clki 1 ? av ss ?? v pin ?? v dd , ec, xt and hs modes note 1: data in the typ column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. 2: negative current is defined as current sourced by the pin. 3: refer to table 1-1 for i/o pin buffer types. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 424 ? 2015 microchip technology inc. table 33-9: dc characteristics: i/o pin output specifications dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ ( 1 ) max units conditions v ol output low voltage do10 i/o ports 0.4 v i ol = 6.6 ma, v dd = 3.6v 0 . 8vi ol = 18 ma, v dd = 3.6v 0 . 3 5vi ol = 5.0 ma, v dd = 2v do16 osco/clko 0.18 v i ol = 6.6 ma, v dd = 3.6v 0 . 2vi ol = 5.0 ma, v dd = 2v v oh output high voltage do20 i/o ports 3.4 v i oh = -3.0 ma, v dd = 3.6v 3.25 v i oh = -6.0 ma, v dd = 3.6v 2.8 v i oh = -18 ma, v dd = 3.6v 1.65 v i oh = -1.0 ma, v dd = 2v 1.4 v i oh = -3.0 ma, v dd = 2v do26 osco/clko 3.3 v i oh = -6.0 ma, v dd = 3.6v 1.85 v i oh = -1.0 ma, v dd = 2v note 1: data in the typ column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. table 33-10: dc characteristics: program memory dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ ( 1 ) max units conditions program flash memory d130 e p cell endurance 10000 e/w -40 ? c to +85 ? c d131 v pr v dd for read v min 3 . 6 vv min = minimum operating voltage d132b v dd for self-timed write v min 3 . 6 vv min = minimum operating voltage d133a t iw self-timed word write cycle time 2 0 ? s self-timed row write cycle time 1 . 5 m s d133b t ie self-timed page erase time 20 40 ms d134 t retd characteristic retention 20 year if no other specifications are violated d135 i ddp supply current during programming 5m a note 1: data in the typ column is at 3.3v, +25c unless otherwise stated. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 425 pic24fj1024ga610/gb610 family table 33-11: internal voltag e regulator specifications table 33-12: high/low-voltage detect characteristics operating conditions: -40c < t a < +85c (unless otherwise stated) param no. symbol characteristics min typ max units comments dvr t vreg voltage regulator start-up time 10 ? svregs = 0 with any por or bor dvr10 v bg internal band gap reference 1.14 1.2 1.26 v dvr11 t bg band gap reference start-up time 1m s dvr20 v rgout regulator output voltage 1.6 1.8 2 v v dd > 2.1v dvr21 c efc external filter capacitor value 10 ? f series resistance < 3 ? recommended; < 5 ? required dvr30 v lvr low-voltage regulator output voltage 1.2 v reten = 1 , lpcfg = 0 operating conditions: -40c < t a < +85c (unless otherwise stated) param no. symbol characteristic min typ max units conditions dc18 v hlvd hlvd voltage on v dd transition hlvdl<3:0> = 0100 ( 1 ) 3.40 3.74 v vdir = 1 hlvdl<3:0> = 0101 3.25 3.58 v hlvdl<3:0> = 0110 2.95 3.25 v hlvdl<3:0> = 0111 2.75 3.04 v hlvdl<3:0> = 1000 2.65 2.93 v hlvdl<3:0> = 1001 2.45 2.75 v hlvdl<3:0> = 1010 2.35 2.64 v hlvdl<3:0> = 1011 2.25 2.50 v hlvdl<3:0> = 1100 2.15 2.39 v hlvdl<3:0> = 1101 2.08 2.28 v hlvdl<3:0> = 1110 2.00 2.17 v dc101 v thl hlvd voltage on hlvdin pin transition hlvdl<3:0> = 1111 1 . 2 0 v dc105 t onlvd hlvd module enable time 5 s from por or hlvden = 1 note 1: trip points for values of hlvd<3:0>, from 0000 to 0011 , are not implemented. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 426 ? 2015 microchip technology inc. table 33-13: comparat or dc specifications table 33-14: comparator voltag e reference dc specifications operating conditions: 2.0v < v dd < 3.6v, -40c < t a < +85c (unless otherwise stated) param no. symbol characteristic min typ max units comments d300 v ioff input offset voltage 12 60 mv d301 v icm input common-mode voltage 0 v dd v ( note 1 ) d302 cmrr common-mode rejection ratio 55 db ( note 1 ) d306 i qcmp av dd quiescent current per comparator 27 a comparator is enabled d307 t resp response time 300 ns ( note 2 ) d308 t mc 2 ov comparator mode change to valid output 10 s d309 i dd operating supply current 30 a av dd = 3.3v note 1: parameters are characterized but not tested. 2: measured with one input at v dd /2 and the other transitioning from v ss to v dd , 40 mv step, 15 mv overdrive. operating conditions: 2.0v < v dd < 3.6v, -40c < t a < +85c (unless otherwise stated) param no. symbol characteristic min typ max units comments vr310 t set settling time 10 s ( note 1 ) vrd311 cvr aa absolute accuracy -100 +100 mv vrd312 cvr ur unit resistor value (r) 4.5 k ? note 1: measures the interval while cvr<4:0> transitions from 11111 to 00000 . table 33-15: ctmu current source specifications dc characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. sym characteristic min typ ( 1 ) max units comments conditions dct10 i out 1 ctmu current source, base range 550 850 na ctmucon1l<1:0> = 00 ( 2 ) 2.5v < v dd < v ddmax dct11 i out 2 ctmu current source, 10x range 5 . 5 ? a ctmucon1l<1:0> = 01 dct12 i out 3 ctmu current source, 100x range 5 5 ? a ctmucon1l<1:0> = 10 dct13 i out 4 ctmu current source, 1000x range 550 ? a ctmucon1l<1:0> = 11 ( 2 ) , ctmucon1h<0> = 0 dct14 i out 5 ctmu current source, high range 2.2 ma ctmucon1l<1:0> = 01 , ctmucon1h<0> = 1 dct21 v delta 1 temperature diode voltage change per degree celsius -1.8 mv/c current = 5.5 a dct22 v delta 2 temperature diode voltage change per degree celsius -1.55 mv/c current = 55 a dct23 vd1 forward voltage 710 mv at 0oc, 5.5 a dct24 vd2 forward voltage 760 mv at 0oc, 55 a note 1: nominal value at center point of current trim range (ctmucon1l<7:2> = 000000 ). 2: do not use this current range with the internal temperature sensing diode. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 427 pic24fj1024ga610/gb610 family 33.2 ac characteristics and timing parameters the information contained in this section defines the pic24fj1024ga610/gb610 family ac characteristics and timing parameters. table 33-16: temperature and vo ltage specifications C ac figure 33-2: load conditions for device timing specifications table 33-17: capacitive loading requirements on output pins ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial operating voltage v dd range as described in section 33.1 dc characteristics . param no. symbol characteristic min typ ( 1 ) max units conditions do50 c osco osco/clko pin 15 pf in xt and hs modes when external clock is used to drive osci do56 c io all i/o pins and osco 50 pf ec mode do58 c b sclx, sdax 400 pf in i 2 c mode note 1: data in the typ column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. v dd /2 c l r l pin pin v ss v ss c l r l =464 ? c l = 50 pf for all pins except osco 15 pf for osco output load condition 1 C for all pins except osco load condition 2 C for osco downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 428 ? 2015 microchip technology inc. figure 33-3: external clock timing table 33-18: external clo ck timing requirements ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ ( 1 ) max units conditions os10 f osc external clki frequency (external clocks allowed only in ec mode) dc 4 3248 mhz mhz ec ecpll ( note 2 ) oscillator frequency 3.5 4 1012 31 10 8 3224 33 mhz mhz mhz mhz khz xt xtpll hs hspll sosc os20 t osc t osc = 1/f osc see parameter os10 for f osc value os25 t cy instruction cycle time ( 3 ) 62.5 dc ns os30 tosl, to s h external clock in (osci) high or low time 0.45 x t osc n s e c os31 tosr, to s f external clock in (osci) rise or fall time 20 ns ec os40 tckr clko rise time ( 4 ) 1 53 0n s os41 tckf clko fall time ( 4 ) 1 53 0n s note 1: data in the typ column is at 3.3v, +25c unless otherwise stated. parameters are for design guidance only and are not tested. 2: represents input to the system clock prescaler. pll dividers and postscalers must still be c onfigured so that the system clock frequency does not exceed the maximum frequency shown in figure 33-1 . 3: instruction cycle period (t cy ) equals two times the input oscillator time base period. all specified values are based on characterization data for that particular oscillator type, under standard operating conditions, with the device executing code. exceeding these specified limits may result in an unstable oscillator opera tion and/or higher than expected current consumption. all devices are tested to operate at min. values with an external clock applied to the osci/clki pin. when an external clock input is used, the max. cycle time limit is dc (no clock) for all devices. 4: measurements are taken in ec mode. the clko signal is measured on the osco pin. clko is low for the q1-q2 period (1/2 t cy ) and high for the q3-q4 period (1/2 t cy ). osci clko q4 q1 q2 q3 q4 q1 os20 os25 os30 os30 os40 os41 os31 os31 q1 q2 q3 q4 q2 q3 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 429 pic24fj1024ga610/gb610 family table 33-19: ac specifications for phase-locked loop mode ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial sym characteristic min typ max units conditions f in input frequency range 2 24 mhz f min minimum output frequency from the frequency multiplier 1 6m h z 4 m h z f in with 4x feedback ratio, 2 mhz f in with 8x feedback ratio f max maximum output frequency from the frequency multiplier 96 mhz 4 mhz f in with 24x net multiplication ratio, 24 mhz f in with 4x net multiplication ratio f slew maximum step function of f in at which the pll will be ensured to maintain lock -4 +4 % full input range of f in t lock lock time for vco 24 ? s with the specified minimum, t ref , and a lock timer count of one cycle, this is the maximum vco lock time supported j fm 8 cumulative jitter of frequency multiplier over voltage and temperature during any eight consecutive cycles of the pll output 0.12 % external 8 mhz crystal and 96 mh z pll mode downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 430 ? 2015 microchip technology inc. table 33-20: internal rc accuracy ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ?? +85c for industrial param no. characteristic min typ max units conditions f20 frc accuracy @ 8 mhz -1.5 +0.15 1.5 % 2.0v ? v dd ?? 3.6v, 0c ? t a ?? +85c ( note 1 ) -2.0 2.0 % 2.0v ? v dd ?? 3.6v, -40c ? t a ?? 0c -0.20 +0.05 -0.20 % 2.0v ? v dd ?? 3.6v, 0c ? t a ?? +85c, self-tune is enabled and locked ( note 2 ) f21 lprc @ 31 khz -20 20 % v cap output voltage = 1.8v f22 osctun step-size 0.05 %/bit f23 frc self-tune lock time 5 8 ms ( note 3 ) note 1: to achieve this accuracy, physical stress applied to the microcontroller pac kage (ex., by flexing the pcb) must be kept to a minimum. 2: accuracy is measured with respect to the reference source. 3: time from reference clock stable, and in range, to frc tuned within range specified by f20 (with self-tune). table 33-21: rc oscillator start-up time ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ max units conditions fr0 t frc frc oscillator start-up time 1 5 ? s fr1 t lprc low-power rc oscillator start-up time 5 0 ? s downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 431 pic24fj1024ga610/gb610 family table 33-22: internal dco accuracy ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ max units conditions f30 f dco dco frequency 7.60 8.00 8.40 mhz 15.2 16.0 16.8 mhz 30.4 32.0 33.6 mhz f31 dco su dco start-up time 1.0 2.0 ? s f32 dco stable dco stabilization period 8 clocks f33 dco dt dco temperature drift 0.4 %/c f34 dco vt dco voltage drift 0.2 %/v f35 dco dc dco duty cycle 48 50 52 % downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 432 ? 2015 microchip technology inc. figure 33-4: clko and i/o timing characteristics table 33-23: clko and i/o timing requirements ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ ( 1 ) max units conditions do31 t io r port output rise time 10 25 ns do32 t io f port output fall time 10 25 ns di35 t inp intx pin high or low time (input) 1t cy di40 t rbp cnx high or low time (input) 1t cy note 1: data in the typ column is at 3.3v, +25c unless otherwise stated. note: refer to figure 33-2 for load conditions. i/o pin (input) i/o pin (output) di35 old value new value di40 do31do32 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 433 pic24fj1024ga610/gb610 family table 33-24: reset and brown-out reset requirements ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min typ max units conditions sy10 t mcl mclr pulse width (low) 2 ? s sy12 t por power-on reset delay 2 ? s sy13 t ioz i/o high-impedance from mclr low or watchdog timer reset lesser of: (3 t cy + 2) or 700 ( 3 t cy + 2) ? s sy25 t bor brown-out reset pulse width 1 ? sv dd ?? v bor sy45 t rst internal state reset time 50 ? s sy71 t pm program memory wake-up time 2 0 ? s sleep wake-up with vregs = 1 1 ? s sleep wake-up with vregs = 0 sy72 t lvr low-voltage regulator wake-up time 9 0 ? s sleep wake-up with vregs = 1 7 0 ? s sleep wake-up with vregs = 0 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 434 ? 2015 microchip technology inc. table 33-25: a/d mo dule specifications ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min. typ max. units conditions device supply ad01 av dd module v dd supply greater of: v dd C 0.3 or 2.2 lesser of: v dd + 0.3 or 3.6 v ad02 av ss module v ss supply v ss C 0.3 v ss + 0.3 v reference inputs ad05 v refh reference voltage high av ss + 1.7 av dd v ad06 v refl reference voltage low av ss av dd C 1.7 v ad07 v ref absolute reference voltage av ss C 0.3 av dd + 0.3 v analog inputs ad10 v inh -v inl full-scale input span v refl v refh v ( note 1 ) ad11 v in absolute input voltage av ss C 0.3 av dd + 0.3 v ad12 v inl absolute v inl input voltage av ss C 0.3 av dd /3 v ad13 leakage current 1.0 610 na v inl = av ss = v refl = 0v, av dd = v refh = 3v, source impedance = 2.5 k ? ad17 r in recommended impedance of analog voltage source 2.5k ? 10-bit a/d accuracy ad20b nr resolution 12 bits ad21b inl integral nonlinearity 1 < 2 lsb v inl = av ss = v refl = 0v, av dd = v refh = 3v ad22b dnl differential nonlinearity < 1 lsb v inl = av ss = v refl = 0v, av dd = v refh = 3v ad23b g err gain error 1 4 lsb v inl = av ss = v refl = 0v, av dd = v refh = 3v ad24b e off offset error 1 2 lsb v inl = av ss = v refl = 0v, av dd = v refh = 3v ad25b monotonicity ( 1 ) guaranteed note 1: measurements are taken with the external v ref + and v ref - used as the a/d voltage reference. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 435 pic24fj1024ga610/gb610 family table 33-26: a/d conversion timing requirements ( 1 ) ac characteristics standard operating conditions: 2.0v to 3.6v (unless otherwise stated) operating temperature -40c ? t a ? +85c for industrial param no. symbol characteristic min. typ max. units conditions clock parameters ad50 t ad a/d clock period 278 ns ad51 t rc a/d internal rc oscillator period 250 ns conversion rate ad55 t conv sar conversion time, 12-bit mode 14 t ad ad55a sar conversion time, 10-bit mode 12 t ad ad56 f cnv throughput rate 200 ksps av dd > 2.7v ( 2 ) ad57 t samp sample time 1 t ad ( note 1 ) clock synchronization ad61 t pss sample start delay from setting sample bit (samp) 1.5 2.5 t ad note 1: because the sample caps will eventually lose charge, clock rates below 10 khz can affect linearity performance, especially at elevated temperatures. 2: throughput rate is based on ad55 + ad57 + ad61 and the period of t ad . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 436 ? 2015 microchip technology inc. figure 33-5: inl vs. code (10-bit mode) figure 33-6: dnl vs. code (10-bit mode) 0.2 0.15 0.1 -0.05 -0.1 0.05 -0.15 -0.2 0 200 400 600 800 1000 0 0 200 400 600 800 1000 0.2 0.15 0.1 -0.05 -0.1 0.05 -0.15 -0.2 0 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 437 pic24fj1024ga610/gb610 family figure 33-7: inl vs. code (12-bit mode) figure 33-8: dnl vs. code (12-bit mode) ( 1 ) 0 1000 2000 3000 4000 0.80.6 0.4 -0.2 -0.4 0.2 -0.6 -0.8 0 0 1000 2000 3000 4000 0.8 0.6 0.4 -0.2 -0.4 0.2 -0.6 -0.8 0 note 1: the following codes have marginal dnl and may result in a missing code: 1023, 2047, 3070 and 3071. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 438 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 439 pic24fj1024ga610/gb610 family 34.0 packaging information 34.1 package marking information 64-lead tqfp (10x10x1 mm) xxxxxxxxxx xxxxxxxxxx yywwnnn example 24fj1024 gb606 1520017 xxxxxxxxxxx 64-lead qfn (9x9x0.9 mm) xxxxxxxxxxx yywwnnn pic24fj1024 example gb606 1550017 legend: xx...x customer-specific information y year code (last digit of calendar year) yy year code (last 2 digits of calendar year) ww week code (week of january 1 is week 01) nnn alphanumeric traceability code note: in the event the full microchip part number cannot be marked on one line, it will be carried over to the next line, thus limiting the number of available characters for customer-specific information. downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 440 ? 2015 microchip technology inc. 34.1 package marking information (continued) 100-lead tqfp (12x12x1 mm) xxxxxxxxxxxx xxxxxxxxxxxx yywwnnn 121-bga (10x10x1.1 mm) xxxxxxxxxxx xxxxxxxxxxx yywwnnn example pic24fj1024 gb610 1520017 example pic24fj1024 1510017 gb610 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 441 pic24fj1024ga610/gb610 family 34.2 package details the following sections give the technical details of the packages. b a 0.25 c 0.25 c 0.10 c a b 0.05 c (datum b) (datum a) c seating plane note 1 1 2 n 2x top view side view bottom view note 1 1 2 n 0.10 c a b 0.10 c a b 0.10 c 0.08 c microchip technology drawing c04-213b sheet 1 of 2 64-lead plastic quad flat, no lead package (mr) ? 9x9x0.9 mm body [qfn] 2x 64x for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging note: with 7.70 x 7.70 exposed pad [qfn] a3 a a1 d e e 64x b d2 e2 k l e 2 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 442 ? 2015 microchip technology inc. microchip technology drawing c04-213b sheet 2 of 2 64-lead plastic quad flat, no lead package (mr) ? 9x9x0.9 mm body [qfn] for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging note: with 7.70 x 7.70 exposed pad [qfn] 0.50 0.30 0.40 contact length l contact-to-exposed pad ref: reference dimension, usually without tolerance, for information purposes only. 3. bsc: basic dimension. theoretically exact value shown without tolerances. 1. notes:2. k- 0.20 - overall height overall length exposed pad width contact thickness number of pins contact width exposed pad length overall width standoff pitch e2 d2 b d a3 e a1 7.80 7.60 7.70 9.00 bsc 0.25 7.70 7.600.20 7.800.30 0.02 9.00 bsc 0.20 ref 0.00 0.05 dimension limits e a n units max min nom 0.50 bsc 0.85 64 0.80 0.90 millimeters dimensioning and tolerancing per asme y14.5m. pin 1 visual index feature may vary, but must be located within the hatched area. package is saw singulated. downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 443 pic24fj1024ga610/gb610 family microchip technology drawing no. c04-2213b 64-lead plastic quad flat, no lead package (mr) ? 9x9x0.9 mm body [qfn] with 0.40 mm contact length and 7.70x7.70mm exposed pad silk screen 12 64 c2 c1 w2 ev ?v y1 x1 e t2 recommended land pattern dimension limits units c2 optional center pad width contact pad spacing optional center pad length contact pitch t2 w2 7.50 7.50 millimeters 0.50 bsc min e max 8.90 contact pad length (x20) contact pad width (x20) y1 x1 0.90 0.30 nom c1 contact pad spacing 8.90 contact pad to center pad (x20) g 0.20 thermal via diameter v thermal via pitch ev 0.301.00 bsc: basic dimension. theoretically exact value shown without tolerances. notes: dimensioning and tolerancing per asme y14.5m for best soldering results, thermal vias, if used, should be filled or tented to avoid solder loss during reflow process 1.2. g ev for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging note: downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 444 ? 2015 microchip technology inc. 0.20 c a-b d 64 x b 0.08 c a-b d c seating plane 4x n/4 tips top view side view for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging note: microchip technology drawing c04-085c sheet 1 of 2 64-lead plastic thin quad flatpack (pt)-10x10x1 mm body, 2.00 mm footprint [tqfp] d e e1 d1 d a b 0.20 h a-b d 4x d1/2 e a 0.08 c a1 a2 see detail 1 a a e1/2 note 1 note 2 1 2 3 n 0.05 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 445 pic24fj1024ga610/gb610 family for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging note: 64-lead plastic thin quad flatpack (pt)-10x10x1 mm body, 2.00 mm footprint [tqfp] 13 12 11 e mold draft angle bottom 13 12 11 d mold draft angle top 0.27 0.22 0.17 b lead width 0.20 - 0.09 c lead thickness 10.00 bsc d1 molded package length 10.00 bsc e1 molded package width 12.00 bsc d overall length 12.00 bsc e overall width 7 3.5 0 i foot angle 0.75 0.60 0.45 l foot length 0.15 - 0.05 a1 standoff 1.05 1.00 0.95 a2 molded package thickness 1.20 - - a overall height 0.50 bsc e lead pitch 64 n number of leads max nom min dimension limits millimeters units footprint l1 1.00 ref 2. chamfers at corners are optional; size may vary. 1. pin 1 visual index feature may vary, but must be located within the hatched area. 4. dimensioning and tolerancing per asme y14.5m bsc: basic dimension. theoretically exact value shown without tolerances. ref: reference dimension, usually without tolerance, for information purposes only. 3. dimensions d1 and e1 do not include mold flash or protrusions. mold flash or protrusions shall not exceed 0.25mm per side. noes: microchip technology drawing c04-085c sheet 2 of 2 l (l1) e c h x x=a?b or d e/2 detail 1 section a-a t downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 446 ? 2015 microchip technology inc. recommended land pattern for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging note: dimension limits units c1 contact pad spacing contact pad spacing contact pitch c2 millimeters 0.50 bsc min e max 11.4011.40 contact pad length (x28) contact pad width (x28) y1 x1 1.50 0.30 bsc: basic dimension. theoretically exact value shown without tolerances. notes: 1. dimensioning and tolerancing per asme y14.5m microchip technology drawing c04-2085b sheet 1 of 1 g distance between pads 0.20 nom 64-lead plastic thin quad flatpack (pt)-10x10x1 mm body, 2.00 mm footprint [tqfp] c2 c1 e g y1 x1 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 447 pic24fj1024ga610/gb610 family 
       
     ! "  #
$ %  &   ! " #$ %! &  '(!%&! %(  % ")%%  % "    * &$   %    
% + , &   - &    "."%!" &"$ 
%!  "$ 
%!    % # "/&&
 "   &    "%   
.0/ 1*2 1 &    %  # % !  ))%!%%    .32  $   &  '! ! )%!%%   '$$& %
!
  % & 3% & %! %
4 " ) '
  % 
 4  
$ % % " % %%
255)))&
&5
4  6% 77.. &  7&% 8 89 : 8!&( $7 " 8  7 "% 1* 9  ;  %  < <  " " 4 4  /  / % "$$  / < / 3%7  % 7 / = / 3%
% 7 .3 3%  > -/> > 9  ?"% . 1* 9  7  %  1* " " 4 ?"% . 1* " " 4 7  %  1* 7 "4   <  7 "?"% ( - @ - " $%  
> > -> " $%  1%%& > > -> d d1 e e1 e b n 123 note 1 note 2 c l a1 l1 a a2 
    ) * 1 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 448 ? 2015 microchip technology inc. note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 449 pic24fj1024ga610/gb610 family b a 0.10 c 0.10 c (datum b) (datum a) 2x top view side view for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging note: note 1 microchip technology drawing c04-148 rev f sheet 1 of 2 d e 2x l k j h g f e dc ba detail b e d1 e1 e a bottom view detail a a1 121-ball plastic thin profile fine pitch ball grid array (bg) - 10x10x1.10 mm body [tfbga] downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 450 ? 2015 microchip technology inc. microchip technology drawing c04-148 rev f sheet 2 of 2 for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging note: 121-ball plastic thin profile fine pitch ball grid array (bg) - dimension limits units d overall width overall length array length array width d1 e1 e millimeters min max 10.00 bsc contact diameter b notes: 1. nom bsc: basic dimension. theoretically exact value shown without tolerances. 2. ref: reference dimension, usually without tolerance, for information purposes only. ball height a1 overall height a contact pitch e 0.80 bsc number of contacts n 121 0.25 0.40 10.00 bsc 1.20 8.00 bsc 8.00 bsc 3. 1.10 1.00 0.30 0.35 nx ?b 0.15 c a b 0.08 c c 0.10 c detail a detail b 0.35 0.45 4. ball interface to package body: 0.37mm nominal diameter. ball a1 visual index feature may vary, but must be located within the hatched area. dimensioning and tolerancing per asme y14.5m. the outer rows and colums of balls are located with respect to datums a and b. 10x10x1.10 mm body [tfbga] downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 451 pic24fj1024ga610/gb610 family downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 452 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 453 pic24fj1024ga610/gb610 family appendix a: revision history revision a (march 2015) original data sheet for the pic24fj1024ga610/ gb610 family of devices. revision b (november 2015) this revision incorporates the following updates: sections: - changed 12-bit conversion rate to 200 ksps in the analog features section on page 1. - added smart card support (iso 7816) information to the peripheral features section on page 2 . - added section 9.3.1 dco overview . - added section 25.4 achieving maximum a/d converter (adc) performance . - added section 30.2 unique device identifier (udid) . - updated section 6.6 programming operations , section 9.6 oscillator modes and usb opera- tion , section 9.6.1 considerations for usb operation , section 9.7 reference clock output , section 9.8 secondary oscillator , section 10.2 instruction-based power-saving modes , section 10.2.2 idle mode , section 12.0 timer1 , section 16.1 time base generator and section 33.0 electrical characteristics registers - updated register 5-1 , register 6-1 , register 7-1 , register 9-4 , register 9-5 , register 18-1 , register 22-3 , register 25-2 , register 25-3 , register 25-6 , register 25-7 , register 30-1 , register 30-5 , register 30-7 , register 30-8 and register 30-9 figures: - updated figure 2-1 , figure 9-2 and figure 25-3 - added figure 33-5 , figure 33-6 , figure 33-7 and figure 33-8 tables: - updated ta b l e 2 - 1 , ta b l e 4 - 1 , tab le 4 - 2 , ta b l e 4 - 3 , ta b l e 4 - 1 0 , ta b l e 9 - 2 , ta b l e 9 - 3 , tab le 3 0- 1 , ta b l e 3 3 - 3 , table 33-4 , table 33-5 , tab le 3 3- 6 , ta b l e 3 3 - 7 , table 33-8 , table 33-9 , tab le 3 3- 11 , table 33-12 , table 33-13 , table 33-15 , table 33-19 , table 33-24 , table 33-25 and table 33-26 . examples: - updated example 15-1 . other minor typographic changes and updates throughout the document. revision c (november 2015) this revision incorporates the following updates: tables: - updated table 33-5 and table 33-20 . figures: - updated figure 33-8 . downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 454 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 455 pic24fj1024ga610/gb610 family index a a/d control registers ...................................................... 348 extended dma operations ....................................... 347 operation .................................................................. 345 transfer functions 10-bit ................................................................ 365 12-bit ................................................................ 364 ac characteristics a/d conversion timing requirements...................... 435 a/d specifications..................................................... 434 and timing parameters........................................... .. 427 capacitive loading on output pins........................... 427 clko and i/o timing requirements ........................ 432 external clock timing requirements........................ 428 internal dco accuracy ............................................. 431 internal rc accuracy ................................................ 430 load conditions for device timing ........................... 427 phase-locked loop mode ........................................ 429 rc oscillator start-up time ...................................... 430 reset and brown-out reset requirements .............. 433 assembler mpasm assembler................................................... 406 b block diagrams 12-bit a/d converter................................................. 346 12-bit a/d converter analog input model................. 363 16-bit asynchronous timer3 and timer5 ................. 187 16-bit synchronous timer2 and timer4 ................... 187 16-bit timer1 module.......................................... ...... 183 32-bit timer mode .................................................... 210 accessing program memory using table instructions ............................................... 78 addressing for table registers................................... 89 bdt mapping for endpoint buffering modes ............ 268 buffer address generation in pia mode................... 350 call stack frame...................................................... 75 clcx input source selection.................................... 337 clcx logic function combinatorial options ............ 336 clcx module ............................................................ 335 comparator voltage reference ................................ 373 conceptual mccpx/sccpx modules ....................... 207 cpu programmers model .......................................... 49 crc module .................................................. ........... 329 crc shift engine detail........................................ .... 329 ctmu connections and internal configuration for capacitance measurement.......................... 376 ctmu typical connections and internal configuration for pulse delay generation ........ 377 ctmu typical connections and internal configuration for time measurement ............... 377 data access from program space address generation .............................................. ............ 77 dma module ................................................ ............... 81 dual 16-bit timer mode ............................................ 209 eds address generation for read............................. 73 eds address generation for write ............................. 74 high/low-voltage detect (hlvd) ............................. 385 i2cx module.............................................. ................ 246 individual comparator configurations, cref = 0 .......................................................... 368 individual comparator configurations, cref = 1, cvrefp = 0 ................................... 368 individual comparator configurations, cref = 1, cvrefp = 1 ................................... 369 input capture x module .................................... 191, 212 mclr pin connection example ................................. 42 on-chip regulator connections............................... 401 oscillator circuit placement ....................................... 45 output compare x (16-bit mode) ............................. 198 output compare x (double-buffered, 16-bit pwm mode) ........................................... 200 output compare x module ....................................... 211 pic24f cpu core ...................................................... 48 pic24fj1024ga610/gb610 family (general) .......... 25 pll module .............................................................. 129 psv operation (lower word)..................................... 80 psv operation (upper word)..................................... 80 recommended minimum connections....................... 41 reset system ............................................................. 97 rtcc module................................................ ........... 310 shared i/o port structure ......................................... 1 47 spix master, frame master connection .................. 243 spix master, frame slave connection .................... 244 spix master/slave connection (enhanced buffer modes)................................. 242 spix master/slave connection (standard mode)............................................... 241 spix module (enhanced mode)................................ 227 spix slave, frame master connection .................... 244 spix slave, frame slave connection ...................... 244 system clock............................................................ 115 timer clock generator ........................................... .. 208 timer2/3 and timer4/5 (32-bit) ................................ 186 triple comparator module........................................ 367 uartx (simplified) ................................................... 254 usb otg bus-powered interface example............. 265 usb otg dual power mode example..................... 265 usb otg host interface example ........................... 266 usb otg interface example ................................... 266 usb otg interrupt funnel ..................................... .. 272 usb otg module............................................. ........ 264 usb otg self-power only mode ............................ 265 watchdog timer (wdt)......................................... ... 403 c c compilers mplab c18.............................................................. 406 capture/compare/pwm/timer auxiliary output ........................................................ 213 general purpose timer ............................................ 209 input capture mode.................................................. 212 output compare mode ............................................. 210 synchronization sources.......................................... 217 time base generator ......................................... ...... 208 capture/compare/pwm/timer (mccp, sccp) ............... 207 charge time measurement unit. see ctmu. clc control registers...................................................... 338 module-specific input sources................................. 341 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 456 ? 2015 microchip technology inc. code examples basic clock switching ............................................... 127 configuring uart1 input/output functions ............. 161 double-word flash programming (c language) ....... 96 eds read from program memory in assembly.......... 79 eds read in assembly............................................... 73 eds write in assembly ............................................... 74 erasing a program memory block (c language) ....... 94 initiating a programming sequence ............................ 94 ioc status read/clear in assembly ......................... 152 port read/write in assembly .................................... 152 port read/write in c ............................................ ..... 152 pwrsav instruction syntax ..................................... 135 setting wrlock bit ................................................. 311 code memory programming example double-word programming ........................................ 95 page erase ................................................. ................ 93 code protection ............................................... ................. 404 comparator voltage reference ...................................... .. 373 configuring................................................................ 373 configurable logic cell (clc) .......................................... 335 configurable logic cell. see clc. configuration bits............................................................ .. 387 configuration word addresses ......................................... 388 core features ..................................................................... 21 cpu..................................................................................... 47 arithmetic logic unit (alu)......................................... 52 clocking scheme ...................................................... 116 control registers ........................................................ 50 core registers ............................................................ 48 programmers model................................................ ... 47 crc data shift direction ................................................... 331 interrupt operation.................................................... 331 polynomials............................................................... 330 setup examples for 16 and 32-bit polynomials ........ 330 user interface ........................................................... 330 ctmu measuring capacitance ............................................ 37 5 measuring die temperature ..................................... 378 measuring time/routing current to a/d input pin............................................. ........ 376 pulse generation and delay ..................................... 376 customer change notification service ............................. 461 customer notification service........................................... 461 customer otp memory .................................................... 404 customer support ............................................... .............. 461 cyclic redundancy check. see crc. d data memory space ........................................................... 59 extended data space (eds) ...................................... 72 memory map ............................................................... 59 near data space ........................................................ 60 organization, alignment............................................ .. 60 sfr space.................................................................. 60 implemented regions ......................................... 60 map, 0000h block ............................................. .. 61 map, 0100h block ............................................. .. 62 map, 0200h block ............................................. .. 63 map, 0300h block ............................................. .. 65 map, 0400h block ............................................. .. 67 map, 0500h block ............................................. .. 69 map, 0600h block ............................................. .. 70 map, 0700h block ............................................. .. 71 software stack............................................................ 75 dc characteristics comparator specifications........................................ 426 comparator voltage reference specifications......... 426 ctmu current source.............................................. 426 ? current (bor, wdt, hlvd, rtcc)...................... 422 high/low-voltage detect .......................................... 425 i/o pin input specifications................................... .... 423 i/o pin output specifications.................................... 424 idle current (i idle ) .................................................... 420 internal voltage regulator specifications................. 425 operating current (i dd ) ............................................ 420 power-down current (i pd )........................................ 421 program memory ...................................................... 424 temperature and voltage specifications.................. 419 thermal operating conditions.................................. 418 thermal packaging................................................... 418 development support ....................................................... 405 device features 100 and 121-pin devices............................................ 24 64-pin devices............................................................ 23 device id bit field descriptions ................................................ 400 registers .................................................................. 400 direct memory access controller. see dma. dma channel trigger sources............................................ 88 control registers ...................................................... .. 84 peripheral module disable (pmd) registers .............. 84 summary of operations.............................................. 82 types of data transfers ............................................. 83 typical setup .............................................................. 84 dma controller ................................................................... 22 dnl................................................................................... 437 e electrical characteristics .............................................. .... 417 absolute maximum ratings ...................................... 417 v/f graph (industrial) ....................................... ........ 418 enhanced parallel master port (epmp) ........................... 297 enhanced parallel master port. see epmp. epmp key features ............................................................ 297 package variations............................................. ...... 297 pin descriptions........................................................ 298 pmdin1, pmdin2 registers .................................... 297 pmdout1, pmdout2 registers ............................ 297 equations 16-bit, 32-bit crc polynomials................................ 330 a/d conversion clock period ................................... 363 baud rate reload calculation.................................. 247 calculating the pwm period..................................... 200 calculation for maximum pwm resolution .............. 201 estimating usb transceiver current consumption .................................................... 267 relationship between device and spix clock speed ..................................................... 244 uartx baud rate with brgh = 0 ........................... 255 uartx baud rate with brgh = 1 ........................... 255 errata .................................................................................. 19 extended data space (eds) ........................................... . 297 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 457 pic24fj1024ga610/gb610 family f flash program memory ...................................................... 89 and table instructions.......................................... ....... 89 control registers ...................................................... .. 90 double-word programming ........................................ 95 enhanced icsp operation.......................................... 90 jtag operation .......................................................... 90 operations .................................................................. 90 programming algorithm .............................................. 93 rtsp operation.......................................................... 90 g guidelines for getting started with 16-bit mcus ................ 41 analog/digital pins configuration during icsp .......... 46 external oscillator pins............................................... 45 icsp pins.................................................................... 44 master clear (mclr ) pin............................................ 42 power supply pins.............................................. ........ 42 unused i/os ................................................................ 46 voltage regulator pin (v cap ) ..................................... 43 h high/low-voltage detect (hlvd) ..................................... 385 high/low-voltage detect. see hlvd. i i/o ports ............................................................................ 147 analog port pins configuration (ansx) .................... 148 configuring analog/digital function of i/o pins........ 148 input voltage levels for port/pin tolerated description input ............................................... 148 open-drain configuration ......................................... 148 parallel (pio) ............................................................ 147 peripheral pin select ................................................ 157 write/read timing .......................................... .......... 148 i 2 c clock rates............................................................... 247 communicating as master in single master environment.......................................... 245 reserved addresses................................................. 247 setting baud rate as bus master............................. 247 slave address masking ............................................ 247 in-circuit debugger ........................................... ................ 404 input capture 32-bit cascaded mode ............................................. 192 operations ................................................................ 192 synchronous and trigger modes.............................. 191 input capture with dedicated timers................................ 191 instruction set overview ................................................................... 411 summary................................................................... 409 symbols used in opcode descriptions..................... 410 interfacing program and data memory spaces .................. 76 inter-integrated circuit. see i 2 c. internet address................................................................ 461 interrupt controller ............................................................ 103 control and status registers .................................... 108 intcon1 .......................................................... 108 intcon2 .......................................................... 108 intcon4 .......................................................... 108 inttreg .......................................................... 108 interrupt vector details ............................................. 105 interrupt vector table (ivt) ...................................... 103 reset sequence ................................................ ....... 103 resources................................................................. 108 interrupt-on-change (ioc) ......................................... ....... 152 j jtag interface ................................................................. 404 k key features .................................................................... 387 l low-voltage/retention regulator..................................... 401 m memory organization ............................................ ............. 53 program memory space............................................. 53 microchip internet web site.............................................. 461 mplab asm30 assembler, linker, librarian ................... 406 mplab integrated development environment software .............................................. 405 mplab pm3 device programmer .................................... 407 mplab real ice in-circuit emulator system ................ 407 mplink object linker/mplib object librarian ................ 406 n near data space ................................................................ 60 o on-chip voltage regulator............................................ ... 401 por.......................................................................... 401 standby mode ................................................. ......... 401 oscillator configuration ............... ..................................... 115 clock switching ........................................................ 126 sequence ................................................. ........ 126 configuration bit values for clock selection ............ 117 control registers...................................................... 117 frc self-tuning....................................................... 127 initial configuration on por ..................................... 116 usb operation ......................................................... 128 special considerations..................................... 130 output compare with dedicated timers........................... 197 operating modes ...................................................... 197 32-bit cascaded mode ..................................... 197 synchronous and trigger modes ..................... 197 operations ................................................................ 198 p packaging details....................................................................... 441 marking..................................................................... 439 peripheral enable bits ........................................... ........... 137 peripheral module disable bits......................................... 137 peripheral pin select (pps)........................................... ... 157 available peripherals and pins................................. 157 configuration control................................................ 160 considerations for selection..................................... 16 1 control registers...................................................... 162 input mapping............................................... ............ 158 mapping exceptions ................................................. 160 output mapping ............................................. ........... 159 peripheral priority .......................................... ........... 157 selectable input sources.......................................... 158 selectable output sources....................................... 159 pic24fj1024ga610/gb610 family pinout descriptions........................................... .......... 26 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 458 ? 2015 microchip technology inc. pin descriptions pic24fjxxxga606...................................................... 5 pic24fjxxxga610...................................................... 9 pic24fjxxxga610 bga .......................................... . 13 pic24fjxxxgb606...................................................... 7 pic24fjxxxgb610 bga .......................................... . 16 pic24fjxxxgb610 tqfp ......................................... 11 power-saving features..................................................... 135 clock frequency, clock switching............................ 135 doze mode................................................................ 136 instruction-based modes .......................................... 135 idle .................................................................... 136 sleep................................................................. 135 selective peripheral power control .......................... 137 program memory space access using table instructions ................................. 78 addressing .................................................................. 76 configuration bits code-protect.............................................. ......... 58 overview ............................................................. 55 configuration word addresses ................................... 57 customer otp memory .............................................. 58 dual partition configuration words............................. 58 dual partition flash memory organization ................. 55 hard memory vectors ................................................. 55 memory map ............................................................... 54 organization.............................................. .................. 55 reading data using eds ........................................... 79 sizes and boundaries ............................................... .. 54 program verification.......................................................... 4 04 pulse-width modulation (pwm) mode .............................. 199 pulse-width modulation. see pwm. pwm duty cycle and period .............................................. 200 r real-time clock and calendar (rtcc)............................ 309 real-time clock and calendar. see rtcc. reference clock output.................................................... 130 register summary peripheral module disable (pmd) ............................ 138 registers ad1chith (a/d scan compare hit, high word)........................................................ 360 ad1chitl (a/d scan compare hit, low word)......................................................... 360 ad1chs (a/d sample select).................................. 358 ad1con1 (a/d control 1) ........................................ 351 ad1con2 (a/d control 2) ........................................ 353 ad1con3 (a/d control 3) ........................................ 355 ad1con4 (a/d control 4) ........................................ 356 ad1con5 (a/d control 5) ........................................ 357 ad1cssh (a/d input scan select, high word) ....... 361 ad1cssl (a/d input scan select, low word) ......... 361 ad1ctmenh (a/d ctmu enable, high word)........ 362 ad1ctmenl (a/d ctmu enable, low word) ......... 362 almdateh (rtcc alarm date high)...................... 321 almdatel (rtcc alarm date low) ....................... 321 almtimeh (rtcc alarm time high) ...................... 320 almtimel (rtcc alarm time low)........................ 320 ancfg (a/d band gap reference configuration) ................................................... 359 ansa (porta analog function selection).............. 149 ansb (portb analog function selection).............. 149 ansc (portc analog function selection) ............. 150 ansd (portd analog function selection) ............. 150 anse (porte analog function selection) ............. 151 ansg (portg analog function selection)............. 151 bdnstat (buffer descriptor n status prototype, cpu mode (bd0stat through bd63stat)) ..................................................... 271 bdnstat (buffer descriptor n status prototype, usb mode (bd0stat through bd63stat)) ..................................................... 270 ccpxcon1h (ccpx control 1 high) ....................... 216 ccpxcon1l (ccpx control 1 low) ........................ 214 ccpxcon2h (ccpx control 2 high) ....................... 219 ccpxcon2l (ccpx control 2 low) ........................ 218 ccpxcon3h (ccpx control 3 high) ....................... 221 ccpxcon3l (ccpx control 3 low) ........................ 220 ccpxstath (ccpx status high) ............................ 223 ccpxstatl (ccpx status low).............................. 222 clcxconh (clcx control high)............................. 339 clcxconl (clcx control low) .............................. 338 clcxglsh (clcx gate logic input select high) ...................................................... 343 clcxglsl (clcx gate logic input select low)....................................................... 341 clcxsel (clcx input mux select)......................... 340 clkdiv (clock divider) ............................................ 120 cmstat (comparator module status)..................... 371 cmxcon (comparator x control, comparators 1 through 3) ............................... 370 corcon (cpu core control) ........................... 51, 110 crccon1 (crc control 1) ..................................... 332 crccon2 (crc control 2) ..................................... 333 crcxorh (crc xor polynomial, high byte) ....... 334 crcxorl (crc xor polynomial, low byte)......... 334 ctmucon1h (ctmu control 1 high) ..................... 381 ctmucon1l (ctmu control 1 low) ...................... 379 ctmucon2l (ctmu control 2 low) ...................... 383 cvrcon (comparator voltage reference control) ........................................... 374 dateh (rtcc date high) ....................................... 319 datel (rtcc date low)......................................... 319 dcocon (digitally controlled oscillator enable) ............................................. 123 dcotun (digitally controlled oscillator tune)........ 122 dmachn (dma channel n control) ........................... 86 dmacon (dma engine control)................................ 85 dmaintn (dma channel n interrupt)......................... 87 fboot configuration ............................................... 389 fbslim configuration .............................................. 391 fbtseq configuration ............................................. 389 fdevopt1 configuration ........................................ 399 ficd configuration ................................................... 398 fosc configuration ................................................. 394 foscsel configuration........................................... 393 fpor configuration ................................................. 397 fsec configuration.................................................. 390 fsign configuration ................................................ 392 fwdt configuration ................................................. 395 hlvdcon (high/low-voltage detect control) ........ 386 i2cxconh (i2cx control high) ................................ 250 i2cxconl (i2cx control low) ................................. 248 i2cxmsk (i2cx slave mode address mask) ............ 252 i2cxstat (i2cx status) ........................................... 251 icxcon1 (input capture x control 1)....................... 193 icxcon2 (input capture x control 2)....................... 194 intcon1 (interrupt control 1).................................. 111 intcon2 (interrupt control 2).................................. 112 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 459 pic24fj1024ga610/gb610 family intcon4 (interrupt control 4).................................. 113 inttreg (interrupt control and status)................... 114 iocfx (interrupt-on-change flag x) ......................... 156 iocnx (interrupt-on-change negative edge x) ........ 155 iocpx (interrupt-on-change positive edge x).......... 155 iocstat (interrupt-on-change status) ................... 154 nvmcon (flash memory control) ............................. 91 ocxcon1 (output compare x control 1) ................ 202 ocxcon2 (output compare x control 2) ................ 204 osccon (oscillator control) ................................... 118 oscdiv (oscillator divisor)...................................... 124 oscfdiv (oscillator fractional divisor)................... 125 osctun (frc oscillator tune)............................... 121 padcon (pad configuration control)...................... 307 padcon (port configuration) .................................. 153 pmcon1 (epmp control 1) ..................................... 299 pmcon2 (epmp control 2) ..................................... 300 pmcon3 (epmp control 3) ..................................... 301 pmcon4 (epmp control 4) ..................................... 302 pmcsxbs (epmp chip select x base address) .................................................. 304 pmcsxcf (epmp chip select x configuration) ................................................... 303 pmcsxmd (epmp chip select x mode) .................. 305 pmd1 (peripheral module disable 1) ....................... 139 pmd2 (peripheral module disable 2) ....................... 140 pmd3 (peripheral module disable 3) ....................... 141 pmd4 (peripheral module disable 4) ....................... 142 pmd5 (peripheral module disable 5) ....................... 143 pmd6 (peripheral module disable 6) ....................... 144 pmd7 (peripheral module disable 7) ....................... 144 pmd8 (peripheral module disable 8) ....................... 145 pmstat (epmp status, slave mode)...................... 306 rcon (reset control) ................................................ 98 refoconh (reference oscillator control high)..................................................... 133 refoconl (reference oscillator control low) ..................................................... 132 refotriml (reference oscillator trim low) ......... 134 rpinr0 (peripheral pin select input 0).................... 162 rpinr1 (peripheral pin select input 1).................... 162 rpinr11 (peripheral pin select input 11)................ 166 rpinr12 (peripheral pin select input 12)................ 167 rpinr14 (peripheral pin select input 14)................ 167 rpinr15 (peripheral pin select input 15)................ 168 rpinr17 (peripheral pin select input 17)................ 168 rpinr18 (peripheral pin select input 18)................ 169 rpinr19 (peripheral pin select input 19)................ 169 rpinr2 (peripheral pin select input 2).................... 163 rpinr20 (peripheral pin select input 20)................ 170 rpinr21 (peripheral pin select input 21)................ 170 rpinr22 (peripheral pin select input 22)................ 171 rpinr23 (peripheral pin select input 23)................ 171 rpinr25 (peripheral pin select input 25)................ 172 rpinr27 (peripheral pin select input 27)................ 172 rpinr28 (peripheral pin select input 28)................ 173 rpinr29 (peripheral pin select input 29)................ 173 rpinr3 (peripheral pin select input 3).................... 163 rpinr4 (peripheral pin select input 4).................... 164 rpinr5 (peripheral pin select input 5).................... 164 rpinr6 (peripheral pin select input 6).................... 165 rpinr7 (peripheral pin select input 7).................... 165 rpinr8 (peripheral pin select input 8).................... 166 rpor0 (peripheral pin select output 0).................. 174 rpor1 (peripheral pin select output 1).................. 174 rpor10 (peripheral pin select output 10) ............. 179 rpor11 (peripheral pin select output 11) ............. 179 rpor12 (peripheral pin select output 12) ............. 180 rpor13 (peripheral pin select output 13) ............. 180 rpor14 (peripheral pin select output 14) ............. 181 rpor15 (peripheral pin select output 15) ............. 181 rpor2 (peripheral pin select output 2) ................. 175 rpor3 (peripheral pin select output 3) ................. 175 rpor4 (peripheral pin select output 4) ................. 176 rpor5 (peripheral pin select output 5) ................. 176 rpor6 (peripheral pin select output 6) ................. 177 rpor7 (peripheral pin select output 7) ................. 177 rpor8 (peripheral pin select output 8) ................. 178 rpor9 (peripheral pin select output 9) ................. 178 rtccon1h (rtcc control 1 high) ........................ 313 rtccon1l (rtcc control 1 low).......................... 312 rtccon2h (rtcc control 2 high) ........................ 315 rtccon2l (rtcc control 2 low).......................... 314 rtccon3l (rtcc control 3 low).......................... 316 rtcstatl (rtcc status low)............................... 317 spixbrgl (spix baud rate generator low) .......... 237 spixbufh (spix buffer high) .................................. 236 spixbufl (spix buffer low).................................... 236 spixcon1h (spix control 1 high) .......................... 230 spixcon1l (spix control 1 low)............................ 228 spixcon2l (spix control 2 low)............................ 232 spiximskh (spix interrupt mask high) ................... 239 spiximskl (spix interrupt mask low)..................... 238 spixstath (spix status high)................................ 235 spixstatl (spix status low) ................................. 233 spixurdth (spix underrun data high) ................. 240 spixurdtl (spix underrun data low) ................... 240 sr (alu status) ............................................. 50, 109 t1con (timer1 control) .......................................... 184 timeh (rtcc time high)........................................ 318 timel (rtcc time low) ......................................... 318 tsadateh (rtcc timestamp a date high).......... 325 tsadatel (rtcc timestamp a date low) ........... 324 tsatimeh (rtcc timestamp a time high) .......... 323 tsatimel (rtcc timestamp a time low)............ 322 txcon (timer2/timer4 control) .............................. 188 tycon (timer3/timer5 control) .............................. 190 u10tgstat (usb otg status, host mode)........... 278 u1addr (usb address).......................................... 284 u1cnfg1 (usb configuration 1)............................. 286 u1cnfg2 (usb configuration 2)............................. 287 u1con (usb control, device mode)....................... 282 u1con (usb control, host mode) .......................... 283 u1eie (usb error interrupt enable)......................... 294 u1eir (usb error interrupt status).......................... 293 u1epn (usb endpoint n control)............................. 295 u1ie (usb interrupt enable, all modes) .................. 292 u1ir (usb interrupt status, device mode) .............. 290 u1ir (usb interrupt status, host mode).................. 291 u1otgcon (usb otg control) ............................. 279 u1otgie (usb otg interrupt enable, host mode) ................................................ ....... 289 u1otgir (usb otg interrupt status, host mode) ................................................ ....... 288 u1pwrc (usb power control) ............................... 280 u1sof (usb otg start-of-token threshold, host mode) ................................................ ....... 285 u1stat (usb status).............................................. 281 u1tok (usb token, host mode) ............................ 284 uxadmd (uartx address detect and match) ........ 262 downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 460 ? 2015 microchip technology inc. uxbrg (uartx baud rate generator).................... 262 uxmode (uartx mode) .......................................... 257 uxrxreg (uartx receive, normally read-only) ........................................ 261 uxsta (uartx status and control) ......................... 259 uxtxreg (uartx transmit, normally write-only)......................................... 261 resets bor (brown-out reset) .............................................. 97 brown-out reset (bor) ............................................ 100 clock source selection............................................. 100 cm (configuration mismatch reset)........................... 97 delay times .............................................................. 101 device times ............................................................ 100 iopuwr (illegal opcode reset) ................................ 97 mclr (master clear pin reset) ................................. 97 por (power-on reset) ............................................... 97 rcon flags, operation .............................................. 99 sfr states................................................................ 100 swr (reset instruction)........................................... 97 trapr (trap conflict reset)...................................... 97 uwr (uninitialized w register reset)........................ 97 wdt (watchdog timer reset).................................... 97 revision history ................................................................ 453 rtcc alarm configuration .................................................. 326 alarm mask settings (figure)..................................... 327 alarm value registers .............................................. 320 calibration................................................................. 326 clock source selection............................................. 311 control registers ...................................................... 312 event timestamping ................................................. 328 power control ........................................................... 327 register mapping ................................................ ...... 311 rtcval register mappings ..................................... 315 source clock............................................................. 309 timestamp registers ................................................ 322 value registers......................................................... 318 write lock ................................................................. 311 s secondary oscillator operation ........................................ 131 serial peripheral interface (spi) ....................................... 225 serial peripheral interface. see spi. software simulator (mplab sim)..................................... 407 software stack .................................................................... 75 special features ................................................................. 22 special features of the cpu............................................. 387 spi audio mode operation .............................................. 227 control registers ...................................................... 228 master mode operation ............................................ 226 slave mode operation .............................................. 22 6 t timer1............................................................................... 183 timer2/3 and timer4/5 ...................................... ............... 185 timing diagrams clko and i/o characteristics .................................. 432 dnl vs. code (10-bit mode)..................................... 436 dnl vs. code (12-bit mode)..................................... 437 external clock........................................................... 428 inl vs. code (10-bit mode) ...................................... 436 inl vs. code (12-bit mode) ...................................... 437 triple comparator............................................................. 367 triple comparator module ......................................... ....... 367 u uart baud rate generator (brg) .................................... 255 infrared support........................................................ 256 operation of uxcts and uxrts pins...................... 256 receiving 8-bit or 9-bit data mode ................................... 256 transmitting 8-bit data mode................................................ 256 9-bit data mode................................................ 256 break and sync sequence ............................... 256 unique device identifier (udid) ....................................... 400 addresses................................................................. 400 universal asynchronous receiver transmitter. see uart. universal serial bus. see usb otg. usb otg.......................................................................... 263 buffer descriptors assignment in different buffering modes ......... 269 buffer descriptors and bdt...................................... 268 control registers ...................................................... 277 device mode operation ............................................ 273 dma interface........................................................... 269 hardware calculating transceiver power requirements ............ 267 hardware configuration............................................ 265 device mode..................................................... 265 host and otg modes....................................... 266 host mode operation............................................. ... 274 interrupts .................................................................. 272 interrupts and usb transactions.............................. 273 operation .................................................................. 276 hnp .................................................................. 277 srp .................................................................. 276 w watchdog timer (wdt)......................................... ........... 402 control register........................................................ 402 windowed operation ............................................. ... 402 www address ................................................................. 461 www, on-line support ....... .............................................. 19 downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 461 pic24fj1024ga610/gb610 family the microchip web site microchip provides online support via our www site at www.microchip.com . this web site is used as a means to make files and information easily available to customers. accessible by using your favorite internet browser, the web site contains the following informa- tion: product support C data sheets and errata, appli- cation notes and sample programs, design resources, users guides and hardware support documents, latest software releases and archived software general technical support C frequently asked questions (faq), technical support requests, online discussion groups, microchip consultant program member listing business of microchip C product selector and ordering guides, latest microchip press releases, listing of seminars and events, listings of micro- chip sales offices, distributors and factory repre- sentatives customer change notification service microchips customer notification service helps keep customers current on microchip products. subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a spec- ified product family or development tool of interest. to register, access the microchip web site at www.microchip.com . under support, click on cus- tomer change notification and follow the registration instructions. customer support users of microchip products can receive assistance through several channels: distributor or representative local sales office field application engineer (fae) technical support customers should contact their distributor, representa- tive or field application engineer (fae) for support. local sales offices are also available to help custom- ers. a listing of sales offices and locations is included in the back of this document. technical support is available through the web site at: http://microchip.com/support downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 462 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 463 pic24fj1024ga610/gb610 family product identification system to order or obtain information, e.g., on pricing or del ivery, refer to the factory or the listed sales office . part no. x /xx xxx pattern package temperature range device device: dspic33ep core tape and reel option: blank = standard packaging (tube or tray) t = tape and reel (1) temperature range: i= - 4 0 ? c to +85 ? c (industrial) e=- 4 0 ? c to +125 ? c (extended) package: mr = qfn (plastic quad flat) pt = tqfp (plastic thin quad flatpack) bg = tfbga (plastic thin profile) pattern: qtp, sqtp, code or special requirements (blank otherwise) examples: a) pic24fj1024gb606-i/mr = industrial temperature, 64-pin qfn package. b) pic24fj1024gb610-i/pt = industrial temperature, 100-pin tqfp package. c) pic24fj1024gb610-i/bg = industrial temperature, 121-pin tfbga package. note 1: tape and reel identifier only appears in the catalog part number description. this identi- fier is used for ordering purposes and is not printed on the device package. check with your microchip sales office for package availability with the tape and reel option. [x] (1) tape and reel option downloaded from: http:///
pic24fj1024ga610/gb610 family ds30010074c-page 464 ? 2015 microchip technology inc. notes: downloaded from: http:///
? 2015 microchip technology inc. ds30010074c-page 465 information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. microchip makes no representations or warranties of any kind whether express or implied, written or oral, statutory or otherwise, related to the information, including but not limited to its condition, quality, performance, merchantability or fitness for purpose . microchip disclaims all liability arising from this information and its use. use of microchip devices in life support and/or safety applications is entirely at the buyers risk, and the buyer agrees to defend, indemnify and hold harmless microchip from any and all damages, claims, suits, or expenses resulting from such use. no licenses are conveyed, implicitly or otherwise, under any microchip intellectual property rights unless otherwise stated. trademarks the microchip name and logo, the microchip logo, dspic, flashflex, flexpwr, jukeblox, k ee l oq , k ee l oq logo, kleer, lancheck, medialb, most, most logo, mplab, optolyzer, pic, picstart, pic 32 logo, righttouch, spynic, sst, sst logo, superflash and uni/o are registered trademarks of microchip tec hnology incorporated in the u.s.a. and other countries. the embedded control solutions company and mtouch are registered trademarks of micr ochip technology incorporated in the u.s.a. analog-for-the-digital age, bodycom, chipkit, chipkit logo, codeguard, dspicdem, dspicdem.net, ecan, in-circuit serial programming, icsp, inter-chip connectivity, kleernet, kleernet logo, miwi, motorbench, mpasm, mpf, mplab certified logo, mplib, mplink, multitrak, netdetach, omniscient code generation, picdem, picdem.net, pickit, pictail, righttouch logo, real ice, sqi, serial quad i/o, total endurance, tsharc, usbcheck, varisense, viewspan, wiperlock, wireless dna, and zena are trademarks of microchip tec hnology incorporated in the u.s.a. and other countries. sqtp is a service mark of mi crochip technology incorporated in the u.s.a. silicon storage technology is a registered trademark of microchip technology inc. in other countries. gestic is a registered trademark of microchip technology germany ii gmbh & co. kg, a subsidiary of microchip technology inc., in other countries. all other trademarks mentioned herein are property of their respective companies. ? 2015, microchip technology incorporated, printed in the u.s.a., all rights reserved. isbn: 978-1-5224-0003-5 note the following details of the code protection feature on microchip devices: microchip products meet the specification cont ained in their particular microchip data sheet. microchip believes that its family of products is one of the most secure families of its kind on the market today, when used i n the intended manner and under normal conditions. there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowledge, require using the microchip produc ts in a manner outside the operating specif ications contained in microchips data sheets. most likely, the person doing so is engaged in theft of intellectual property. microchip is willing to work with the customer who is concerned about the integrity of their code. neither microchip nor any other semiconduc tor manufacturer can guarantee the security of their code. code protection does not mean that we are guaranteeing the product as unbreakable. code protection is constantly evolving. we at microchip are co mmitted to continuously improvin g the code protection features of our products. attempts to break microchips code protection feature may be a violation of the digital millennium copyright act. if such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that act. microchip received iso/ts-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona; gresham, oregon and design centers in california and india. the companys quality system processes and procedures are for its pic ? mcus and dspic ? dscs, k ee l oq ? code hopping devices, serial eeproms, microperipherals, nonvolatile memory an d analog products. in addition, microchips quality system for the design and manufacture of development systems is iso 9001:2000 certified. quality management s ystem certified by dnv == iso/ts 16949 == downloaded from: http:///
ds30010074c-page 466 ? 2015 microchip technology inc. americas corporate office 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7200 fax: 480-792-7277 technical support: http://www.microchip.com/ support web address: www.microchip.com atlanta duluth, ga tel: 678-957-9614 fax: 678-957-1455 austin, tx tel: 512-257-3370 boston westborough, ma tel: 774-760-0087 fax: 774-760-0088 chicago itasca, il tel: 630-285-0071 fax: 630-285-0075 cleveland independence, oh tel: 216-447-0464 fax: 216-447-0643 dallas addison, tx tel: 972-818-7423 fax: 972-818-2924 detroit novi, mi tel: 248-848-4000 houston, tx tel: 281-894-5983 indianapolis noblesville, in tel: 317-773-8323 fax: 317-773-5453 los angeles mission viejo, ca tel: 949-462-9523 fax: 949-462-9608 new york, ny tel: 631-435-6000 san jose, ca tel: 408-735-9110 canada - toronto tel: 905-673-0699 fax: 905-673-6509 asia/pacific asia pacific office suites 3707-14, 37th floor tower 6, the gateway harbour city, kowloon hong kong tel: 852-2943-5100 fax: 852-2401-3431 australia - sydney tel: 61-2-9868-6733 fax: 61-2-9868-6755 china - beijing tel: 86-10-8569-7000 fax: 86-10-8528-2104 china - chengdu tel: 86-28-8665-5511 fax: 86-28-8665-7889 china - chongqing tel: 86-23-8980-9588 fax: 86-23-8980-9500 china - dongguan tel: 86-769-8702-9880 china - hangzhou tel: 86-571-8792-8115 fax: 86-571-8792-8116 china - hong kong sar tel: 852-2943-5100 fax: 852-2401-3431 china - nanjing tel: 86-25-8473-2460 fax: 86-25-8473-2470 china - qingdao tel: 86-532-8502-7355 fax: 86-532-8502-7205 china - shanghai tel: 86-21-5407-5533 fax: 86-21-5407-5066 china - shenyang tel: 86-24-2334-2829 fax: 86-24-2334-2393 china - shenzhen tel: 86-755-8864-2200 fax: 86-755-8203-1760 china - wuhan tel: 86-27-5980-5300 fax: 86-27-5980-5118 china - xian tel: 86-29-8833-7252 fax: 86-29-8833-7256 asia/pacific china - xiamen tel: 86-592-2388138 fax: 86-592-2388130 china - zhuhai tel: 86-756-3210040 fax: 86-756-3210049 india - bangalore tel: 91-80-3090-4444 fax: 91-80-3090-4123 india - new delhi tel: 91-11-4160-8631 fax: 91-11-4160-8632 india - pune tel: 91-20-3019-1500 japan - osaka tel: 81-6-6152-7160 fax: 81-6-6152-9310 japan - tokyo tel: 81-3-6880- 3770 fax: 81-3-6880-3771 korea - daegu tel: 82-53-744-4301 fax: 82-53-744-4302 korea - seoul tel: 82-2-554-7200 fax: 82-2-558-5932 or 82-2-558-5934 malaysia - kuala lumpur tel: 60-3-6201-9857 fax: 60-3-6201-9859 malaysia - penang tel: 60-4-227-8870 fax: 60-4-227-4068 philippines - manila tel: 63-2-634-9065 fax: 63-2-634-9069 singapore tel: 65-6334-8870 fax: 65-6334-8850 taiwan - hsin chu tel: 886-3-5778-366 fax: 886-3-5770-955 taiwan - kaohsiung tel: 886-7-213-7828 taiwan - taipei tel: 886-2-2508-8600 fax: 886-2-2508-0102 thailand - bangkok tel: 66-2-694-1351 fax: 66-2-694-1350 europe austria - wels tel: 43-7242-2244-39 fax: 43-7242-2244-393 denmark - copenhagen tel: 45-4450-2828 fax: 45-4485-2829 france - paris tel: 33-1-69-53-63-20 fax: 33-1-69-30-90-79 germany - dusseldorf tel: 49-2129-3766400 germany - karlsruhe tel: 49-721-625370 germany - munich tel: 49-89-627-144-0 fax: 49-89-627-144-44 italy - milan tel: 39-0331-742611 fax: 39-0331-466781 italy - venice tel: 39-049-7625286 netherlands - drunen tel: 31-416-690399 fax: 31-416-690340 poland - warsaw tel: 48-22-3325737 spain - madrid tel: 34-91-708-08-90 fax: 34-91-708-08-91 sweden - stockholm tel: 46-8-5090-4654 uk - wokingham tel: 44-118-921-5800 fax: 44-118-921-5820 worldwide sales and service 07/14/15 downloaded from: http:///


▲Up To Search▲   

 
Price & Availability of PIC24FJ512GA610T-IBG

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X